Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onMouseOver="window.status=....... 1

Status
Not open for further replies.

wolfmah

Programmer
Oct 24, 2001
17
CA
Hi there!

onMouseOver="window.status='SOMETHING';return true"

Everybody know this line of code. But my question is : is it possible to make the SOMETHING into a function that will automaticaly show my hyperlink name instead of always re-naming my hyperlink in this part.

And also, if you understand what I mean ¦-) I'd like to know if I can put this line in a CSS file or something else that could apply a status bar name to all my hyperlink on my web page. What I mean is that if I got a hyperlink that say "clik here", this text will appear in the status bar, but if another hyperlink under it say "goodbye", the status bar will show "goodbye" and that, without having the obligation of typing the same line of code thousands of time...

Maybe I'm dreaming, but if it exist, I'd like to ear of it! :-D

Thank
wolfmah
 
I'm not sure there's a cross-browser compatible way of doing that, but try this:
Code:
onMouseOver="window.status=this.text;return true"
Hopefully this in this context will give you a reference to the anchor object. The text property of an anchor object is what you want.

Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
I just tested this in IE. Doesn't work. BUT, this does:
Code:
onMouseOver="window.status=this.innerHTML;return true"
It also works in NS6.1, but NOT in NS4.7.

Guess I was right about cross-browser solutions.

You COULD write a function to determine which browser is being used and execute the appropriate code based on that. Just pass this as a parameter to the function. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Thank a lot! This will help me. :-D I still want to know if it's possible to apply a status bar name to all my hyperlink on my web page whit only one JS file, but...oh well....

Ho yeah, I got one more question that may sound similar. Is there a trick, like the one seen above (this.innerHTML), that could show a title (or alt-text) of an image name (wihtout the extension) in hyperlink without having to write it down yourself?
 
Hi Wolfmah,

Well, what what you could do is use the type of function
that TSDragon suggested to get the this.name value
by naming all the hyperlinks numbers like 0,1,2,3,4,5 and
the looping through an array to get the appropriate status
bar text. I haven't tested this. It's just a thought.

Hope this helps,

BobbaFet
Everyone has a right to my opinion.
E-mail me at cwcon@programmer.net
Be a nice guy 'n press that little ol'
VVV---(this one) for me ;-)
 
This is something interesting you could consider. It should show the innerHTML if the browser offers that property. Otherwise, the function shows the second string you send it. Take a look at it in IE and NS and you can see it work.

<html>
<head>
<title>Show Status</title>
<script language=&quot;JavaScript&quot;>
function showStatus(xInner,xText)
{
if(typeof(xInner)!=&quot;undefined&quot;)
window.status=xInner;
else
window.status=xText;
}
</script>
</head>
<body>
<a href=&quot; onmouseover=&quot;showStatus(this.innerHTML,'Click to go to Yahoo');return true;&quot; onmouseout=&quot;showStatus('','');&quot;></body>
</html>
 
I just ran a test in NS4.7: the anchor.innerHTML property shows up as &quot;undefined&quot;, and the anchor.text property comes up &quot;null&quot; (even though I found that property on the Netscape web site!), so I guess there's no way to do anything useful for NS4.7.

As for making an onMouseOver event handler that would apply to ALL links automatically, I suspect there IS a way to do that, but I don't know how to do it. Hopefully one of the real experts here will. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Thanks everyone, but there is still one more thing that I'd like to know. Does a chart for the event.keyCode exist somewhere on the net? I mean that it will tell that the code 78 is for Ctrl+N and so on. It would be great if it does.

See ya!
wolfmah
 
you could make one really easy with javascript and just pushing the different keys. have the script add a new line to a textarea for each key pressed. then, run through every key on the board and print the textarea theEclipse
eclipse_web@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
Hey eclipse, sounds to me like you just volunteered to build a chart that way and create a FAQ! :) Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top