louieaw 0 Posted August 10, 2007 Report Share Posted August 10, 2007 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> Quote Link to post Share on other sites
Kingy 0 Posted August 10, 2007 Report Share Posted August 10, 2007 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. Quote Link to post Share on other sites
aspnetguy 30 Posted August 10, 2007 Report Share Posted August 10, 2007 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> Quote Link to post Share on other sites
Kingy 0 Posted August 10, 2007 Report Share Posted August 10, 2007 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. Quote Link to post Share on other sites
louieaw 0 Posted August 10, 2007 Author Report Share Posted August 10, 2007 ok thanks, they all work. i appreciate it! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.