Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    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-03-2002 at 12:23 AM.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •