[web] Whats wrong wit da javascript?
do [ source ] and [ /source ] without the spaces btw. WHAT WOULD BE WRONG WITH THIS LINE?
document.write("<a href='www.thissux.org' onMouseOver='alert('dont click me')'>Link</a>");
<html><head><title>Cory's Page</title></head><body><A HREF="jmouse.htm" onMouseover="javascript:window.status='Hi there!'; return true">Place your mouse here!</A></body></html>
to use javascript in a mouse event without using a function in a script tag you have to state that its javascript like this javascript:
I found a way to do it but i coulda sworn i could do it the other way i did it like so:
EDIT THANKS the monkster u helped a lot. I believe the tutorial SHOULD have said that. Shitty tut i'd say =D
<html><head><title>Cory's Page</title></head><body bgcolor="black"><script language="javascript">function doit(){alert('THIS SUCKS');}</script><a href="http://www.gamedev.net" onMouseOver="doit()">THIS SUCKS</a></body></html>
EDIT THANKS the monkster u helped a lot. I believe the tutorial SHOULD have said that. Shitty tut i'd say =D
Why are you making onmouseover return?
EDIT: Is it for debugging purposes. If so nevermind me bc i use notepad woot :D
EDIT: Is it for debugging purposes. If so nevermind me bc i use notepad woot :D
Both of these methods (calling a script or inlining) works:
The reason the original script doesn't work is that you should't have put the script tag in there. Since it assumes that everything within the script tags is javascript it tries to run it and that obviously dosn't work (HTML code isn't executable).<br><br>Themonkster's example would also work, but I've included some more info.
<html><head><title>test</title><script language="javascript">function change(text){window.status=text;return true;}</script></head><body bgcolor="blue"><a href="http://www.vamis.org" onMouseOver="window.status='hi there'; return true;">Vamis</a><br><a href="http://www.vamis.org" onMouseOver="return change('hi there2');">Vamis</a><br></body></html>
The reason the original script doesn't work is that you should't have put the script tag in there. Since it assumes that everything within the script tags is javascript it tries to run it and that obviously dosn't work (HTML code isn't executable).<br><br>Themonkster's example would also work, but I've included some more info.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement