SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    May 2005
    Posts
    209
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question onmouseover highlighting of text

    this is how i call th function hoverIt:
    PHP Code:
    print "<input id= 'hover' onmouseover = hoverIt(1); onmouseout = "hoverIt(0);" type=submit name=\"linksub\" size=\"2\" value=\"ADMINISTRATORS CLICK HERE\" style={border=0;text-decoration:none;color:blue;background-color:grey;cursor:hand;} onClick='document.form.submit() ;'>"
    this is how i have defined the function in the head section:

    <SCRIPT language="JavaScript">

    function hoverIt(state)
    {
    el = document.getElementById('hover');
    el.style.background = (state ==1) ? 'cyan': 'grey';
    }

    </SCRIPT>

    plz. at any cost tell me the mistake...

    as soon as i position the mouse on the text and then move it out i get the following runtime error:
    line 8:
    error:invalid argument

    line 8 is:
    el = document.getElementById('hover');
    note that error occurs when i move the mouse out from the text

    plz. at any cost tell me the mistake...i m in real agony....

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    This is probably better off in the javascript forum my friend!

    SpikeZ
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •