louieaw Posted August 10, 2007 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> Link to comment Share on other sites More sharing options...
Kingy Posted August 10, 2007 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. Link to comment Share on other sites More sharing options...
aspnetguy Posted August 10, 2007 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> Link to comment Share on other sites More sharing options...
Kingy Posted August 10, 2007 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. Link to comment Share on other sites More sharing options...
louieaw Posted August 10, 2007 Author Share Posted August 10, 2007 ok thanks, they all work. i appreciate it! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.