Solved

Mouse over text

Posted on 2003-10-21
4
188 Views
Last Modified: 2010-04-09
Hello,

Is there a possibility when you want to create a mouseover text of a regular text (by using <span title=""> for example) to format the mouseover text.

Example by mouse over of the text "Register" the following text should appear:

                          * Click on this button
                          * Fill in the form
                          * Click Submit

Thanks in advance
0
Comment
Question by:bvdm23
4 Comments
 
LVL 31

Accepted Solution

by:
seanpowell earned 100 total points
ID: 9590787
Somethng like this should work for you (IE and Netscape):
<html>
<head>
<script>
function showtip(current,e,text)
{
   if (document.all)
   {
      thetitle=text.split('<br>')
      if (thetitle.length > 1)
      {
        thetitles=""
        for (i=0; i<thetitle.length; i++)
           thetitles += thetitle[i] + "\r\n"
        current.title = thetitles
      }
      else current.title = text
   }

   else if (document.layers)
   {
       document.tooltip.document.write(
           '<layer bgColor="#FFFFE7" style="border:1px ' +
           'solid black; font-size:12px;color:#000000;">' + text + '</layer>')
       document.tooltip.document.close()
       document.tooltip.left=e.pageX+5
       document.tooltip.top=e.pageY+5
       document.tooltip.visibility="show"
   }
}

function hidetip()
{
    if (document.layers)
        document.tooltip.visibility="hidden"
}
</script>
</head>
<body>
<div id=tooltip style="position:absolute;visibility:hidden"></div>
<A href="#" onmouseover="showtip(this,event,'* Click on this button<br>* Fill in the form<br>* Click Submit')" onmouseout="hidetip()">Register</a>
</body>
</html>
0
 
LVL 2

Expert Comment

by:RichardAllsebrook
ID: 9591176
If you want to do something clever with your mouse overs, i can heartily recommend overLIB ( http://www.bosrup.com/web/overlib/ )

It does everthing you need and loads more.
0
 

Expert Comment

by:lbyi
ID: 9596460
hi bvdm23

give this a try

<span title="* Click on this button
* Fill in the form
* Click Submit">Register
</span>

works in explorer only - carriage return creates the newline

cheers
0
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 9600189
Hi,

And yet another tested version:

<html>
<head>
<script>

var txtArray = new Array();
 txtArray[0] = "<ul><ol>* Click on this button</ol><ol>* Fill in the form</ol><ol>* Click Submit</ol></ul>"
 txtArray[1] = "<ul><ol>* Click on this button</ol><ol>* Jump up and down twice</ol><ol>* Go home and wait</ol></ul>"


function doit(showDiv, divID, txtNdx)
{

var txt = txtArray[txtNdx];

var  divObj = (document.layers) ? document.layers[divID] : (document.all) ? document.all[divID] : document.getElementById(divID);

if (document.layers)
{
  divObj.document.open();
  divObj.document.write(txt);
  divObj.document.close();
}
else
{
  divObj.innerHTML = txt;
}
var divStyle =  (document.layers) ? divObj : divObj.style;

divStyle.visibility = (showDiv) ? 'visible' : 'hidden';
}
</script>
</head>
<body>
<div id="theDiv" style="position:absolute;visibility:hidden"></div>
<A href="#" onmouseover="doit(1, 'theDiv',0)" onmouseout="doit(0, 'theDiv',0)">Register</a><br />
<A href="#" onmouseover="doit(1, 'theDiv',1)" onmouseout="doit(0, 'theDiv',1)">Unregister</a>
</body>
</html>

Vinny
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now