...

View Full Version : Simple Syntax Question



peterinwa
08-02-2002, 09:34 PM
I simply want an image href which takes you to a new url if you click on it, but also calls a function onMouseOver. I'm struggling with the use of " and ' and ; and so on. Something like this:

<a href="javascript:location='newURL.html'" onMouseOver="callFunction()">
<img src="images/button_07.jpg" width=125 height=45></a>

I get an error message pointing to the first character "h" in href no matter what I try.

Thanks.

scroots
08-02-2002, 09:49 PM
try
<a href="javascript:location=newURL.html" onMouseOver="callFunction()">
<img src="images/button_07.jpg" width=125 height=45></a>

scroots

JohnKrutsch
08-02-2002, 11:16 PM
Why not just use the normal href?

<a href="newURL.htm" onmouseover="callFunction()">
<img src="images/button_07.jpg" width="125" height="45" /></a>

Short of seeing the function you are calling not much else could be wrong

peterinwa
08-02-2002, 11:24 PM
Seeing your replies made me see the syntax error was elsewhere. Thanks, it works now.

About using javascript:location... yes, it certainly wasn't necessary.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum