Solved

Displaying text only when onMouseOver event occurs

Posted on 2002-07-15
7
175 Views
Last Modified: 2008-03-17
Hello,
I would like to display text in an area only when an onMouseOver event occurs.
For example.
If I have a calendar on a page I would like to have events for the dates. When a user puts their mouse over the date or event on that date then a description of that event is displayed below the calendar. When they move the mouse away then the description of that event is no longer displayed.

How may this be possible.

Thanks,
Ivan
0
Comment
Question by:icarey
7 Comments
 
LVL 30

Expert Comment

by:third
ID: 7156163
0
 
LVL 12

Expert Comment

by:lexxwern
ID: 7156246
<html>
<head>
<title>Tooltips</title>
</head>
<body>
<a nohref onmouseover="document.all.tooltip1.style.visibility='visible'" onmouseout="document.all.tooltip1.style.visibility='hidden'">This is My Text</a>
<div id="tooltip1" style="display;block; position:absolute; visibility:hidden; top:10px; left:10px; height:10px; width:100px; font-family:verdana; font-size:9px; border:1px solid #cccccc; background-color:#eeeeee">
This is my tooltip
</div>
</body>
</html>





or





<a nohref title="Your ToolTip">Your Text Here</a>
0
 
LVL 2

Expert Comment

by:mgaurav
ID: 7156263
<form name="myForm">
<textarea name="comments" value=""></textarea>
</form>

<a href="javascript://" onmouseover="tooltip('details')" onmouseout="tooltip('')" onclick="return false;">July 16, 2002</a>


<script>
 function tooltip(tip)
 {
   document.myForm.comments.value = tip;
 }
</script>


HIH,
mGaurav
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 1

Expert Comment

by:zeheb
ID: 7156789
<SCRIPT LANG="JavaScript">
    function ShowText()
    {
        document.all.item("DisplayText").innerText = "Some Text"
    }
   
    function HideText()
    {
        document.all.item("DisplayText").innerText = ""
    }
</SCRIPT>
</HEAD>
<BODY>
    <SPAN ID="DisplayText" OnMouseOver="JavaScript:ShowText()" OnMouseOut="JavaScript:HideText()">
    &nbsp
    </SPAN>
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 200 total points
ID: 7157053
If you want it cross-browser, it get very limited because netscrap 4.x
only supports mouse over for links images and layers

<html>
<!-- cross-browser text display dynamically from mouseoveR a link
-->
<style>
   .EVNTcls {visibility:hidden;position:absolute;top:250;left:40}
   a:hover {color:white;background-color:blue}
</style>
<script language="JavaScript">
<!--
   var ACTIVElist=false;
// browser detection using DOM detection:

if (document.getElementById)
{
   var LoLev=false;
   var HiLev=true;
   var IE5=(document.all) ? true : false;
   var NS6=(!document.all) ? true : false;
}
else
{
   var HiLev=false;
   var LoLev=true;
   var IE4=(document.all) ? true : false;
   var NS4=(document.layers) ? true : false;
}

   function ShowBlock(EL)
   {
      if (NS4)
      {
         ACTIVElist=document.layers[EL];
      }
      else
      {
         if (IE4)
         {
            ACTIVElist=document.all[EL].style;
         }
         else
         {
            if (HiLev)
            {
               ACTIVElist=document.getElementById(EL).style;
            }
         }
      }
      ACTIVElist.visibility="visible";
   }
//-->
</script>
</head>
<body>

<div id="linklst" style=position:absolute;left:40;top:100">
   <a href="blah1.htm" onMouseOver="ShowBlock('id1')"
                       onMouseOut="ACTIVElist.visibility='hidden'"> blah1
   </><br /><br />
   <a href="blah2.htm" onMouseOver="ShowBlock('id2')"
                       onMouseOut="ACTIVElist.visibility='hidden'"> blah2
   </a><br /><br />
   <a href="blah3.htm" onMouseOver="ShowBlock('id3')"
                       onMouseOut="ACTIVElist.visibility='hidden'"> blah3
   </a><br /><br />
   <a href="redirect_back.htm" onMouseOver="ShowBlock('id4')"
                       onMouseOut="ACTIVElist.visibility='hidden'"> blah4
   </a><br /><br />
</div>
<div id="id1" class="EVNTcls">
   JULY 15TH EVENTS<br />
   1st event for July 15<br />
   another event for July 15th<br />
   etc
</div>
<!-- each list is in its own layer with only one visible at a time
-->
<div id="id2" class="EVNTcls" >
   JULY 16TH EVENTS<br />
   1st event for July 16<br />
   another event for July 16th<br />
   etc
</div>
<div id="id3" class="EVNTcls">
   JULY 17TH EVENTS<br />
   1st event for July 17<br />
   another event for July 17th<br />
   etc<br />
   etc ;)<br />
   etc [:)<br />
   etc {:x)<br />
   etc :=)<br />
   etc B}<br />
</div>
<div id="id4" class="EVNTcls">
   JULY 18TH EVENTS<br />
   1st event for July 18<br />
   another event for July 18th<br />
   etc
</div>
</body>
</html>

If you do not need to support Netscrap 4.x then you can put the
mouse events on any tag.

Cd&
0
 
LVL 3

Author Comment

by:icarey
ID: 7166083
Thanks to all for your answers
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 7166710
Glad we could help. Thanks for the A. :^)

Cd&
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Jquery GMAP3 Hierarchy 1 28
Jquery-Javascript setAttribute function help 7 11
jQuery Scroll To Top 5 12
html Uncheck Checkbox 2 13
Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

831 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