in reply to Java script question

on the mouseover event you dont need "javascript:" so your code should look like
print "<a href=\"index.html\" ONMOUSEOVER=\"pop('Avaerage lenght of ga +me played','#CCCCCC')\" ONMOUSEOUT=\"kill()\">AVERAGE</a>";

Replies are listed 'Best First'.
Re: Re: Java script question
by swarddb (Novice) on Aug 02, 2001 at 22:23 UTC
    It still dies on the pop according to Visual Dev editor. that may mean absolutly nothing however.
      one thing you should use to debug this is netscape!

      type in
      javascript:
      in the url field
      gets you the javascript debugger
      it should tell you what the error is
      in a much clearer way than ie and/or visualdev would

      one thing:
      you dont need the
      javascript:
      if the javascript function is in the html file {or perl output}
      aka
      onmouseover=pop('Avaerage lenght of game played','#CCCCCC')

      also you might notice the semi colon after your dbl quote
      thats not right and since your only using one
      function , in javascript you dont need that semi colon

      here is your code reworked and running:
      <html> <head> <script> function kill() { alert('kill'); } function pop (text, color) { alert (text +" "+ color); } </script> </head> <body> <a href="js.html" ONMOUSEOVER="pop('Avaerage lenght of game played','# +CCCCCC')" ONMOUSEOUT="kill()">AVERAGE</a> </body> </html>

      always try to build a flat file to test javascripts
      before inserting them into perl code
      hope that helps
      Well, If it is still generating errors you probably should post the pop and/or kill functions. I tested the small (corrected) block above and it worked fine for me ( using fake pop/kill functions )
        Here is the pop and kill function snipped straight from the cgi. Thanks for your help !me.
        <style TYPE="text/css"> <!-- body{ overflow:scroll;overflow-x:hidden } .popper { position : absolute; visibility : hidden; } //--> </style>
        <SCRIPT> var nav = (document.layers); var iex = (document.all); var skn = (nav) ? document.topdeck : topdeck.style; if (nav) document.captureEvents(Event.MOUSEMOVE); document.onmousemove = get_mouse; function pop(msg,bak) { var content ="<TABLE WIDTH=130 BORDER=0 CELLPADDING=2 CELLSPACING=0 BG +COLOR=#000000><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSP +ACING=0><TR><TD><CENT ER><FONT COLOR=#FFFFFF SIZE=2><B>Detailed Info</B></FONT></CENTER></TD +></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 +BGCOLOR="+bak+"><TR>< TD><FONT COLOR=#000000 SIZE=2><CENTER>"+msg+"</CENTER></FONT></TD></TR +></TABLE></TD></TR></TABLE>"; if (nav) { skn.document.write(content); skn.document.close(); skn.visibility = "visible"; } else if (iex) { document.all("topdeck").innerHTML = content; skn.visibility = "visible"; } } function get_mouse(e) { var x = (nav) ? e.pageX : event.x+document.body.scrollLeft; var y = (nav) ? e.pageY : event.y+document.body.scrollTop; skn.left = x - 60; skn.top = y+20; } function kill() { skn.visibility = "hidden"; } </SCRIPT>