Jump to content

Javascript error


pulpfiction

Recommended Posts

I am using VS.NETJavascript code in the HTML page<script language="javascript"> function test() { // alert('working 1') document.location.href=('http://www.google.com'); // alert('after') }</script>I am calling this function in 2 ways 1. From the HTML page itself using,<input type="Button1" size="110" width="100" name="test" onclick="test();">2. From the .aspx.vb file,Button2.Attributes.Add("onclick", "java script:window.test();")When I click the Button1 the Google site is loaded, but when I click the Button2 the google site is not loaded and stays in the same page.When I uncomment the alert command the page is loaded for button2, only when i wait for the page to load and then give an OK for the alert.Is it the problem with time required for the page to load or whats wrong with the code...Why is this so????

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...