This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Question on MouseOver

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a text eg. "Test". When I bring the mouse over it, I want to display "Test Now".
How can I do this? I would like to use onMouseOver and not HTML's tool tip.
Thanks
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bhaswati
in order for onmouseover to work you have to define it within an html element like <P> or <A> or any of the other that support onmouseover. something like this:
<p onmouseover='mouseOverfunction()>this is my test text</p>
then define your function something along these lines:
function mouseOverfunction(){
alert("you moused over my test text");
}
if you dont want the alert box (and beep) you can use the status bar like this:
window.status="you moused over the test text!";
I dont know if there is a way to get a tooltip like appearance though, but either of these should work for you.
hope that helps
Dave
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
this is the code you need:

<html>
<head>
<title></title>
<script language="javascript">
function now()
{
document.write("test now");
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<a href="#" OnmouseOver="now()">test </a>
</body>
</html>

The word test must be a link to invoke javascript function. If you want it to look like normal text you can use CSS to do that OR if it's a link and you want "Test now" to be a link too just include the HTML tags in the document.write brackets.
Terry
 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you are asking for doesn't seem like like a good idea, unless you were to display the resulting text in the status bar. Constanly alerting the user or writing text to the screen can become a real pain. Also, writing text to the screen may not work since you would be writing text outside of the <body> and <html> tags. The status bar is the best way to go.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
digging up this old thread because my question is on the same line.

I've a table. Each cell contains a link. when i take the mouse to the link it shows the javascript function it will call including the value. since the value is big and contains html code, the status bar becomes full of junk. i mean it does not look good. so, i was trying to use OnMouseOver and window. status to show a clean text there such as "click here to do this or that". something like

< a href="javascript:someFunction(someVar)" onMouse0ver="javascript:changeStatus()" >..............

function changeStatus(){
window. status = "Text goes here";
}

problem is, i can see both. when the mouse is on side the cell but not on the link, i see "text goes here". but when the mouse is on the link i can see what I want to hide.

is there any way to do what i'm trying to do? if yes, what. thanks.
 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If instead of putting your Javascript function in the href, you put it in onc1ick, the browser shouldn't display it in the status bar.
 
author
Posts: 15385
6
 
Mkhaya Tini
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Eric, but I already implimented it using Garann Means's method. so, thanks both of you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic