Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Should be a simple question but I can't find an answer.

    Hello,

    I'm trying to make an information box pop up whenever the page is clicked in exactly the spot where the mouse is located but I can't find out anywhere how to do this. It just needs to be a square box with a border (not a full new window) that can display HTML. If someone could help me I'd greatly appreciate it.

    Thanks very much.

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,505
    Thanks
    3
    Thanked 501 Times in 488 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    <!--
    function zxcWWHS(){
     if (document.all){
      zxcCur='hand';
      zxcWH=document.documentElement.clientHeight;
      zxcWW=document.documentElement.clientWidth;
      zxcWS=document.documentElement.scrollTop;
      if (zxcWH==0){
       zxcWS=document.body.scrollTop;
       zxcWH=document.body.clientHeight;
       zxcWW=document.body.clientWidth;
      }
     }
     else if (document.getElementById){
      zxcCur='pointer';
      zxcWH=window.innerHeight-15;
      zxcWW=window.innerWidth-15;
      zxcWS=window.pageYOffset;
     }
     zxcWC=Math.round(zxcWW/2);
     return zxcWS;
    }
    
    function ShowMe(event){
     if(!event) var event=window.event;
     if (document.all){ zxcMseX=event.clientX; zxcMseY=event.clientY+zxcWWHS(); }
     else {zxcMseX=event.pageX; zxcMseY=event.pageY; }
     document.getElementById('fred').style.left=(zxcMseX)+'px';
     document.getElementById('fred').style.top=(zxcMseY)+'px';
    }
    
    document.onmousedown=function(event){ ShowMe(event); }
    //-->
    </script>
    
    </head>
    
    <body>
    <div id="fred" style="position:absolute;width:100px;height:100px;background-color:#FFFFCC;border:solid black 1px;" ></div>
    <div id="fred" style="width:1px;height:1100px;" ></div>
    </body>
    
    </html>
    search
    http://www.vicsjavascripts.org.uk or google for ToolTip

  • #3
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wow! Thanks so much...you've been so helpful. Great site too.

    -Josh


  •  

    Posting Permissions

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