Click to See Complete Forum and Search --> : setTimeout function (altho it's HTML function)


jedioutcaster
12-22-2003, 08:30 AM
Can anyone PLEASE tell me what's wrong with this script?

<style type=text/css>
TD { cursor:hand }
</style>
<script language=jscript>

var timeouta = null
var timeoutb = null

function clr(a){
eval(a+".style.visibility='hidden'")
}

function dropmenu(a){
eval(a+".style.visibility='visible'")
}

function menuexe(a,mod){
switch(mod){
case "a":
if(timeoutb){
clearTimeout(timeoutb)
}
timeouta=setTimeout(dropmenu(a),200)
break
case "b":
if(timeouta){
clearTimeout(timeouta)
}
timeoutb=setTimeout(clr(a),200)
break
}
}

</script>
<body>
<table>

<table border=1>
<td width=100 onmouseover='menuexe(this.name,"a")' onmouseout='menuexe(this.name,"b")' name="menua">testtest</td>
<table border=1 style="visibility: hidden; filter: alpha(opacity=80); position: absolute; top=40" onmouseover='menuexe(this.id,"a")' onmouseout='menuexe(this.id,"b")' id="menua">
<td width=100>testtest</td>
</table>
</table>

</table>
</body>


This script was designed to function as a menu. The mod variables are for determining dropping or clearing up menus. I wonder why the setTimeout function was not functioning properly.

Everytime I try to run it, the boldfaced lines always cause an "Invalid Argument" error. I wonder if anyone could debug that for me.

PLEASE HELP ME!!! THANKS A MILLION!!!!!!!!!!!!!!!!!!!!!!!

pnaj
12-22-2003, 10:32 AM
Haven't checked anything else out but you call the setTimeout function like ...

timeouta = setTimeout('dropmenu()',200, a);