Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Calling javascript with a href in firefox?

I have a page on my website where I use a javascript when a link is clicked to make sure a checkbox is checked before moving on. This code:

<a href="javascript:validate(terms);" onmouseover="image1.src=loadImage1.src;" onmouseout="image1.src=staticImage1.src;"><img src="images/Download1.gif" img name="image1" border=0></a>

works great in Opera and IE, but not in Firefox. Can anyone help me?

Update:

This code goes where the "..." is showing: "><img

Update 2:

I've tried all that you said and it still works fine in Opera and IE, but when I click on the image in Firefox it just doesn't seem to run the script.

1 Answer

Relevance
  • Jeff E
    Lv 4
    1 decade ago
    Favorite Answer

    You did not close the img tag. Note in valid xhtml it should close itself with /> with a space before the /> If that does not fix your problem, you may want to switch to onclick instead of the href in the a tag , or try moving the mouseout and mouseovers into the img tag.

    Also try in the a tag leaving the ; off after the function in the href

    Also in the img tag your - img name= is wrong , as the img tag in valid xhtml does not use name= or img name= it does use id= or class=

    Added: Please post a link to the page, perhaps I can check it out further. Or e-mail me (unblock yours) with the entire page and script, perhaps the problem is elsewhere? A link would be preferred and I would be glad to try and help further!

Still have questions? Get your answers by asking now.