<A> tag issues in IE 9.0

Posted on 2011-10-04
Last Modified: 2012-05-12

I have the folliwing <a> tag syntax and just upgraded to IE 9.0 and the code doesn't work.
It was and still working in IE 8.0

<a href="JavaScript:myFunction();"><img src="/images/my_button1.gif" border="0" width="50" height="20" alt="Submit"></a>

Any help is really appreciated

Thanks in advance
Question by:Tpaul_10
    LVL 10

    Expert Comment

    There is a new element in IE 9 A Tags to delay validation until the content has finished rendering.
    All other browsers will ignore this tag.

    Author Comment

    Thanks for the quick reply.
    Do i need to add, defer="defer" in my "A" tag for IE 9.0 to work? Have tried, but didn't work.
    How to fix the issue, appreciate your help
    LVL 10

    Accepted Solution

    Original Post is invalid as href is not an attribute for script
    <a href="JavaScript:myFunction();"><img src="/images/my_button1.gif" border="0" width="50" height="20" alt="Submit"></a>

    Minimum change required but assumes that myFunction changes the _self.location
    View will move to top of the construct.
    <a href="#" onclick="JavaScript:myFunction();" defer="defer"><img src="/images/my_button1.gif" border="0" width="50" height="20" alt="Submit"></a>

    if you don't need CSS info from the A tag. Then this would be the normal method and should work across all browsers.
    <img src="/images/my_button1.gif" border="0" width="50" height="20" alt="Submit" onclick="myFunction()" defer="defer">

    There are form image elements as well that might be more appropriate for your use.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Introduction This warning has to be one of the most commonly issued warnings in the history of PHP.  The article explains why this warning arises and what to do to mitigate the problem. How this Happens HTTP headers include many different kinds…
    Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now