Foros del Web » Programando para Internet » Javascript »

Javascript no me funciona en chrome

Estas en el tema de Javascript no me funciona en chrome en el foro de Javascript en Foros del Web. hola, Tengo un codigo en javascript de un texto en movimiento y no me funciona en el explorador chrome.. A continuacion esta el codigo para ...
  #1 (permalink)  
Antiguo 07/05/2012, 15:42
 
Fecha de Ingreso: mayo-2011
Mensajes: 38
Antigüedad: 12 años, 11 meses
Puntos: 0
Javascript no me funciona en chrome

hola,
Tengo un codigo en javascript de un texto en movimiento y no me funciona en el explorador chrome..
A continuacion esta el codigo para ver si me pueden ayudar..


Cita:
//en el head
Código:
<script language="JavaScript" type="text/JavaScript">

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

</script>

Cita:
//fuera del html
Código:
<script language="javascript1.2">
//Specify speed of scroll. Larger=faster // (ie: 5)
var scrollspeed=cache=1

function initialize(){
marqueeheight=document.all? parent.document.all.datamain.height : parent.document.getElementById("datamain").getAttribute("height")
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top=230
thelength=dataobj.offsetHeight
setTimeout("scrolltest()",200)
}


function scrolltest(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed
if (parseInt(dataobj.style.top)<thelength*(-1))
dataobj.style.top=230
setTimeout("scrolltest()",40)
}


window.onload=initialize

</script>

Que tengo que agregarle o cambiarle para que me funcione en todos los exploradores???

Les agradeceria su ayuda
  #2 (permalink)  
Antiguo 07/05/2012, 23:54
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 9 meses
Puntos: 1567
Respuesta: Javascript no me funciona en chrome

Tenés que pasar también el css y el html, dónde si veo un error es en
var scrollspeed=cache=1
que creo debería ser
var scrollspeed=1
Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.
  #3 (permalink)  
Antiguo 08/05/2012, 12:03
 
Fecha de Ingreso: mayo-2011
Mensajes: 38
Antigüedad: 12 años, 11 meses
Puntos: 0
Respuesta: Javascript no me funciona en chrome

Este es el codigo completo

Código:
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<title>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
body {
	background-color: #000;
}
.link-noticias {	color: #CCC;
	text-decoration: none;
	font: Arial;
	font-size: 16px;
	font-family: Tahoma;
}
A:link {
	text-decoration:none;
	color: #FF0;
}
A:hover {
	text-decoration:underline;
}
-->
</style>
</head>
 
<body>
<div id="datacontainer" style="position: absolute; top: 11px; left: 10px; width: 652px; visibility: visible;  height: 250px; background-color: #000000; layer-background-color: #000000; border: 1px none #000000;" onMouseOver="scrollspeed=0" onMouseOut="scrollspeed=cache" class="texto">
  <table width="614" border="0" class="">
    <tr>
      <td width="608"><strong><span class="link-noticias">Encuentran  nueve cadaveres  colgados de un puente en mexico.... <a href="#">mas info</a></span></strong></td>
    </tr>
    <tr>
      <td><strong><span class="link-noticias">El Samsung Galaxy Nexus ya esta en colombia... <a href="#">mas info</a></span></strong></td>
    </tr>
    <tr>
      <td><strong><span class="link-noticias">La corte constitucional considera excequible ley de regalias... <a href="#">mas info</a></span></strong></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
  </table>
</div>
</body>
</html>
<script language="javascript1.2">
//Specify speed of scroll. Larger=faster // (ie: 5)
var scrollspeed=cache=1

function initialize(){
marqueeheight=document.all? parent.document.all.datamain.height : parent.document.getElementById("datamain").getAttribute("height")
dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
dataobj.style.top=230
thelength=dataobj.offsetHeight
setTimeout("scrolltest()",200)
}


function scrolltest(){
dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed
if (parseInt(dataobj.style.top)<thelength*(-1))
dataobj.style.top=230
setTimeout("scrolltest()",40)
}


window.onload=initialize

</script>
  #4 (permalink)  
Antiguo 08/05/2012, 12:27
Avatar de emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 9 meses
Puntos: 1567
Respuesta: Javascript no me funciona en chrome

Estás seguro que eso te funciona en otros navegadores? No debería hacerlo en ninguno, por ejemplo la script hace referencia a un elemento de id "datamain", y ese elemento no está definido en ninguna parte.

Además salvo indicación contraria tus scripts deberían estar dentro del <head> a continuación de tu css, ó en el body, pero nunca fuera del HTML

Parece ser una marquesina que se desplaza, te sugiero que consulte la página dónde sacaste la script
Algunas similares las podés encontrar en
http://www.dynamicdrive.com/dynamicindex2/

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.
  #5 (permalink)  
Antiguo 10/05/2012, 09:03
 
Fecha de Ingreso: mayo-2011
Mensajes: 38
Antigüedad: 12 años, 11 meses
Puntos: 0
Respuesta: Javascript no me funciona en chrome

ahh pere q me falto la pag donde se muestra el la ejecucion del codigo anterior q se llama noticias.htm

este es el index.html

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Noticias</title>
</head>

<body>

<table width="296" border="0" align="center">
  <tr align="center" class="menu">
    <td width="94"><a href="index.html">Inicio</a></td>
    <td width="94" class="menu"><a href="noticias.html">Noti Links</a></td>
    <td width="94" class="menu"><a href="contact.php">Contacto</a></td>
  </tr>
</table>
<br />

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="1190" border="0" class="">
  <tr>
    <td colspan="3" valign="top"><iframe id="datamain" src="noticias_local.html" width="680" height="250"
		 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe></td>
    <td width="555" rowspan="2">
  </tr>
  <tr>
    <td colspan="3" valign="top">&nbsp;</td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

<table width="1240" border="0">
  <tr>
    <td width="487" align="center"><span class="copyrigth">© 2012 - Ingenierojas. Todos los derechos reservados</span>.</td>
    <td width="943" align="right"><img src="INGENIE ROJAS copia.png" width="195" height="49" /></td>
  </tr>
</table>
<table width="200" border="0" align="center">
  <tr>
    <td align="center" class="menu1"><a href="index.html" class="menu">Regresar</a></td>
  </tr>
</table>
<p>&nbsp;</p>

</body>
</html>

Etiquetas: chrome, html, scroll
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 18:22.