SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast dnectom's Avatar
    Join Date
    Dec 2005
    Location
    Lincolnshire, Uk
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hide/Show Div :|

    Hey,
    Im trying to add a help div to my form.. I want it to only display if a mouse goes over the image..
    Doesn't seem to work at all..
    Anyone got any idea why?

    Heres the html
    Code:
    <img onMouseOut="handleClick('close', 'help1'); return false" onMouseOver="handleClick('open', 'help1'); return false" src="../img/icons/help.gif" width="16" height="16" border="0">
    		<div style="display: none;" id="help1">hmm</div><br />
    Heres the Javascript
    Code:
    function hideLayer(whichLayer) {
    if (document.getElementById) {
    document.getElementById(whichLayer).style.display = "none";
    }
    else if (document.all) {
    document.all[whichlayer].style.display = "none";
    }
    else if (document.layers) {
    document.layers[whichLayer].display = "none";
    }
    }
    
    function showLayer(whichLayer) {
    if (document.getElementById) {
    document.getElementById(whichLayer).style.display = "";
    }
    else if (document.all) {
    document.all[whichlayer].style.display = "";
    }
    else if (document.layers) {
    document.layers[whichLayer].display = "";
    }
    }
    
    function handleClick(whichClick, div) {
    if (whichClick == "close") {
    hideLayer(div);
    }
    else if (whichClick == "open") {
    showLayer(div);
    }
    }

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What does the JavaScript console in Firefox say?


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
  •