javascript Redirect wont work with "image" button in ASP.NET , java , javascript Romania
  • 10 years ago

    I've got this Javascript fuction below

    function doit()


    window.location.href = '';


    Then I got this simple HTLM code in my Test.aspx page

    <input type="button" value="Redirect" onclick="doit();" />

    <input type="image" src="PrettyGraphic.gif" onclick="doit();" />

    Problem is the regular button (type=button) works fine (the page gets redirected okay) but the image button does NOT. And this problem happens only when its an aspx file. With a regular .htm file, everuthing works great.

    Any help would be greatly appreaciated




  • 9 years ago


    try the below one...

    function doit()

        window.location.href = '';
        return false;


     <input type="image" src="PrettyGraphic.gif" onclick="return doit();" />


Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic