Can a href title show in a specified div?

Discussion in 'JavaScript' started by youlichika, Sep 8, 2010.

  1. #1
    I want to move mouse on <a href="www.google.com" title="google" onclick="search.php" target="_blank">google</a>, but I do not want the title "google" be showed near the hyperlink. I want show it in a specified "div" layer.
    the "a href" and "onclick" are occupied.
    Can any one get a good method? Thanks.
     
    youlichika, Sep 8, 2010 IP
  2. tdemetri

    tdemetri Peon

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    what you are asking to do is really just a 'dis-jointed rollover'.

    first, take out the title from the href. then , create a div( or span) wherever you want it. give it an id. style it with css for display:none.

    i say to wrap the a tag inside a span or div tag. then give that span/div tag an onmouse over/onmouseout functions to display that div on mouseover and to remove it on mouseout.

    here is some code:

    <style type="text/css">
    
    #divA {
    	display:none;
    	font-family:Verdana, Geneva, sans-serif;
    	font-size:9px;
    	color:#669;
    }
    </style>
    
    <script type="text/javascript">
    function showDiv(){
    document.getElementById("divA").style.display="inline";	
    }
    
    function closeDiv(){
    document.getElementById("divA").style.display="none";	
    }
    
    </script>
    </head>
    
    <body>
    
    <span onmouseover="showDiv()" onmouseout="closeDiv()"> <a href="http://www.google.com">google</a></span>
    
    <span id="divA" > google.com</span>
    
    </body>
    Code (markup):
    hope that helps
     
    tdemetri, Sep 10, 2010 IP
  3. youlichika

    youlichika Greenhorn

    Messages:
    74
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    Thanks for your anwser.
    This can do what I want.
     
    youlichika, Sep 10, 2010 IP