[web] Whats wrong wit da javascript?

Started by
24 comments, last by evolutional 19 years, 8 months ago
tell me how to do the code bit on the forum and I'll paste the source
Advertisement
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>");
Favorite Quotes:Gandalf: You cannot pass!|Smeagol: We don't need you!|Sloth: Hey you guys!|
<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 &#106avascript in a mouse event without using a function in a script tag you have to state that its &#106avascript like this &#106avascript:
I found a way to do it but i coulda sworn i could do it the other way i did it like so:
<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
Favorite Quotes:Gandalf: You cannot pass!|Smeagol: We don't need you!|Sloth: Hey you guys!|
like my first example but read above post
Why are you making onmouseover return?
EDIT: Is it for debugging purposes. If so nevermind me bc i use notepad woot :D
Favorite Quotes:Gandalf: You cannot pass!|Smeagol: We don't need you!|Sloth: Hey you guys!|
just copied your code but it does not need to. my aim was to make your code work m8 :P

Both of these methods (calling a script or inlining) works:

<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 &#106avascript 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.
Monkster u got an aim i may need you again :D
Favorite Quotes:Gandalf: You cannot pass!|Smeagol: We don't need you!|Sloth: Hey you guys!|

This topic is closed to new replies.

Advertisement