Closed Thread Icon

Topic awaiting preservation: Stopping this function Pages that link to <a href="https://ozoneasylum.com/backlink?for=8245" title="Pages that link to Topic awaiting preservation: Stopping this function" rel="nofollow" >Topic awaiting preservation: Stopping this function\

 
Author Thread
Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 07-23-2002 10:21

Time ago we made something similar to this:
I have this script:

code:
<script language="JavaScript1.2">
<script language="JavaScript1.2">

var delay=100 //pausa (en milisegundos)
var fcontent=new Array()
begintag='<font face="Arial" size=2>' //tag que abre los mensajes
fcontent[0]="<a href='#'>hola</a>"
fcontent[1]="<a href='#'>hola 2</a>"
fcontent[2]="<a href='#'>hola 3</a>"
closetag='</font>'

var fwidth=150 //ancho
var fheight=150 //alto

///No editar/////////////////

var ie4=document.all&&!document.getElementById
var ns4=document.layers
var DOM2=document.getElementById
var index=0

if (DOM2)
faderdelay=100

//function to change content
function changecontent(){
if (index>=fcontent.length)
index=0
if (DOM2){
document.getElementById("fscroller").style.color="rgb(255,255,255)"
document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag

}
else if (ie4)
document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag
else if (ns4){
document.fscrollerns.document.fscrollerns_sub.document.write(begintag+fcontent[index]+closetag)
document.fscrollerns.document.fscrollerns_sub.document.close()
}

index++
setTimeout("changecontent()",delay+faderdelay);
}


if (ie4&#0124; &#0124;DOM2)
document.write('<div id="fscroller" style="border:1px solid black;width:'+fwidth+';height:'+fheight+';padding:2px"></div>')
window.onload=changecontent
</script>



this change the content every time into the layer:
<ilayer id="fscrollerns" width=&{fwidth}; height=&{fheight};><layer id="fscrollerns_sub" width=&{fwidth}; height=&{fheight}; left=0 top=0></layer></ilayer>

Then, I want to make the script stops when the mouse is over, and i assigned the setTimeout("colorfade()",20); to a variable (tiempo=setTimeout("colorfade()",20)
Then to stop it I made a function:

code:
function detener()
{clearTimeout(tiempo)}



My problem is: I need to add the mouseover function into the array fcontent
And I'm makinng this:

code:
var delay=100 //pausa (en milisegundos)
var fcontent=new Array()
begintag='<font face="Arial" size=2>' //tag que abre los mensajes
fcontent[0]="<a href='#' onmuseover='detener();'>hola</a>"
fcontent[1]="<a href='#' onmuseover='detener();'>hola 2</a>"
fcontent[2]="<a href='#' onmuseover='detener();'>hola 3</a>"
closetag='</font>'



But seems not to work, then I thought:' Lets make the moseover part into a variable!, the problem could be the quotes (Singles and not double)'

And I made something like this:

code:
var  moseover=onmuseover="detener();"
begintag='<font face="Arial" size=2>' //tag que abre los mensajes
fcontent[0]="<a href='#' '+mouseover+'>hola</a>"
fcontent[1]="<a href='#' '+mouseover+'>hola 2</a>"
fcontent[2]="<a href='#' '+mouseover+'>hola 3</a>"
closetag='</font>'



But nothing happens!!!!!!





Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 07-23-2002 12:52

The line

var moseover=onmuseover="detener();"

has the effect of setting the variable onmuseover to the value "detener();", and then setting the variable moseover to the same value "detener();". It's coincidence that this didn't cause a syntax error. You made two mistakes:

1. watch your spelling of "mouse".
2. you must contain the string expression within quotes.

The correct line would be

var mouseover = 'onmouseover="detener();"';

Notice that I used single quotes, since you have double quotes inside the string. (HTML requires double quotes, while Javascript allows either double or single.) Another solution would be to use backslashes to "escape" the double quotes:

var mouseover = "onmouseover=\"detener();\"";

Try one of those and see if they work.

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 07-23-2002 13:06

none of them worked for me, Slime, I make another link, out of the div, and the onmouseover ="detener();" worked fine, I think that the problem is with that variable, Maybe when I insert it into the script??


Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 07-24-2002 11:57

ERROR FOUND:

fcontent[0]="<a href='#' '+mouseover+'>hola</a>"
Is not single coute, it must be double quote: fcontent[0]="<a href='#' "+mouseover+">hola</a>"

« BackwardsOnwards »

Show Forum Drop Down Menu