Jump to content
louieaw

!#!#!ON MOUSE OVER HELP!#!#!

Recommended Posts

I need help on ONMOUSEOVER!! :) See I made this script, so when you put you mouse over it, it turns bold!! Cool, but I'm having a problem. It does the function "mouseOver()", but not "mouseOut()"Here's my scriptcan somebody point out wat's wrong with it, and why it wont do "mouseOut()"??????

<html><head><script type="text/javascript">function mouseOver(){document.write ('<b><a href="http://www.thelouisworld.com">Hi</a><b/>')}function mouseOut(){document.write ('<a href="http://www.thelouisworld.com">Hello</a>')}</script></head><body><a href="http://www.w3schools.com" onmouseover="mouseOver()" onmouseout="mouseOut()">Hello</a></body></html>

Share this post


Link to post
Share on other sites

Looking at it but how come your body link takes you to w3schools instead of the louiseworld place you want?You just want the link to take you to one place right.Assuming you want nothing but the font going bold and the link only taking you to louiseworld, you can actually use CSS.I usually link my css externally but in this case I'll show you how to put it in your main page.<html><head><style>A:hover {font-weight:bold}</style></head><body><a href="http://www.thelouisworld.com">Hello</a></body></html>That's it, test it out, when you hover above your link it'll go bold.

Share this post


Link to post
Share on other sites

Kingy's way is the best. CSS is best for presentation. However, for the fun of it,

<html><head><script type="text/javascript">function mouseOver(link){  link.style.fontWeight = "bold";}function mouseOut(link){  link.style.fontWeight = "normal";}</script></head><body><a href="http://www.w3schools.com"onmouseover="mouseOver(this)" onmouseout="mouseOut(this)">Hello</a></body></html>

or even

<html><head></head><body><a href="http://www.w3schools.com"onmouseover="this.style.fontWeight='bold'" onmouseout="this.style.fontWeight='normal'">Hello</a></body></html>

Share this post


Link to post
Share on other sites

I'll also mention that using this method all the links in your page will go bold on mouseover, so there's no need to code each individual link with a mouseover/mouseout. :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...