Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-02-2002, 09:34 PM   PM User | #1
peterinwa
Regular Coder

 
Join Date: Jun 2002
Location: Vancouver, WA
Posts: 233
Thanks: 2
Thanked 0 Times in 0 Posts
peterinwa is an unknown quantity at this point
Simple Syntax Question

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.
peterinwa is offline   Reply With Quote
Old 08-02-2002, 09:49 PM   PM User | #2
scroots
Senior Coder

 
Join Date: Jun 2002
Location: UK
Posts: 1,137
Thanks: 0
Thanked 0 Times in 0 Posts
scroots is an unknown quantity at this point
try
<a href="javascript:location=newURL.html" onMouseOver="callFunction()">
<img src="images/button_07.jpg" width=125 height=45></a>

scroots
__________________
Spammers next time you spam me consider the implications:
(1) that you will be persuaded by me(in a legitimate mannor)
(2)It is worthless to you, when i have finished
scroots is offline   Reply With Quote
Old 08-02-2002, 11:16 PM   PM User | #3
JohnKrutsch
Regular Coder

 
Join Date: Jun 2002
Location: The Planet Earth Code Poet: True
Posts: 282
Thanks: 0
Thanked 1 Time in 1 Post
JohnKrutsch is an unknown quantity at this point
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

Last edited by JohnKrutsch; 08-02-2002 at 11:23 PM..
JohnKrutsch is offline   Reply With Quote
Old 08-02-2002, 11:24 PM   PM User | #4
peterinwa
Regular Coder

 
Join Date: Jun 2002
Location: Vancouver, WA
Posts: 233
Thanks: 2
Thanked 0 Times in 0 Posts
peterinwa is an unknown quantity at this point
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.
peterinwa is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:30 AM.


Advertisement
Log in to turn off these ads.