Solved

Mouse over text

Posted on 2003-10-21
4
198 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

914 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

21 Experts available now in Live!

Get 1:1 Help Now