Sign in to follow this  

[web] Whats wrong wit da javascript?

This topic is 4866 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Trying to get this to work. I cant get any javascript to work for like the onmouseclick or mouseovers. heres my source COPIED FROM A TUTORIAL BUT DOESN"T WORK!
<html>
<head>
<title>Cory's Page</title>
</head>
<body bgcolor = "black">
<SCRIPT language = "javascript">
<A HREF="jmouse.htm" onMouseover="window.status='Hi there!'; return true">Place your mouse here!</A>
</SCRIPT>
</body>
</html>

Plz help =D

Share this post


Link to post
Share on other sites
<code>

<html>
<head>
<title>Cory's Page</title>
<script>
function changeText(sText){
status = sText
}
</script>
</head>
<body bgcolor = "black">

Place your mouse here!

</body>
</html>

</code>

try that
EDIT
your need to view source as I can never remeber how to do code

onMouseover="changeText('Hi There')

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
A) That changes the status text. That's the text that appears in the bottom of the browser window, as in where it says done in Mozilla.
B) The problem with the onmouseover does not have to do with the spaces, but the spaces are still a problem.
C)Stop speaking ghetto.

Share this post


Link to post
Share on other sites
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>");

Share this post


Link to post
Share on other sites


<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>


Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 javascript it tries to run it and that obviously dosn't work (HTML code isn't executable).

Themonkster's example would also work, but I've included some more info.

Share this post


Link to post
Share on other sites
In javascript you dont have to declare strings or something? Like you put text as a variable for you function withought ever saying string text or var text.

Share this post


Link to post
Share on other sites
Quote:
Original post by SSJCORY
Why are you making onmouseover return?
EDIT: Is it for debugging purposes. If so nevermind me bc i use notepad woot :D


If you don't include "return true" the status bar is immediately updated again with the link address. As a result you can't see what's been written until you move the mouse. Try and see.

Share this post


Link to post
Share on other sites

This topic is 4866 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this