Solved

Displaying text only when onMouseOver event occurs

Posted on 2002-07-15
7
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ckeditor not working on textarea created by javascript function 5 25
ASP sending two datas 2 23
javascript and jquery question 4 24
Calculating percentage 2 30
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

733 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