Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on MouseOver

 
Bhaswati Karmakar
Ranch Hand
Posts: 32
  • 0
  • 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
 
Dave Vick
Ranch Hand
Posts: 3244
  • 0
  • 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
 
Terence Doyle
Ranch Hand
Posts: 328
  • 0
  • 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
 
Conrad Kirby
Ranch Hand
Posts: 178
  • 0
  • 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.
 
Mkhaya Tini
Greenhorn
Posts: 23
  • 0
  • 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.
 
Garann Means
Ranch Hand
Posts: 214
  • 0
  • 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.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
 
Mkhaya Tini
Greenhorn
Posts: 23
  • 0
  • 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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic