File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Question on MouseOver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Question on MouseOver" Watch "Question on MouseOver" New topic
Author

Question on MouseOver

Bhaswati Karmakar
Ranch Hand

Joined: May 10, 2001
Posts: 32
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

Joined: May 10, 2001
Posts: 3244
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


Dave
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
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


Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
Conrad Kirby
Ranch Hand

Joined: Jun 17, 2001
Posts: 178
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

Joined: Oct 06, 2005
Posts: 23
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

Joined: Jan 28, 2002
Posts: 214
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
look at:
http://www.javascriptkit.com/script/script2/hidestatus.shtml

Eric
Mkhaya Tini
Greenhorn

Joined: Oct 06, 2005
Posts: 23
thanks Eric, but I already implimented it using Garann Means's method. so, thanks both of you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on MouseOver
 
Similar Threads
SCJP objectives
Crossing my fingers
Tree
Increase memory for tomcat
How many of the ranchers took the beta test?