faqts : Computers : Programming : Languages : JavaScript : Document

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 17 people (24%) answered Yes
Recently 1 of 3 people (33%) answered Yes

Entry

Which code executed first after location.href ='execMy.cgi' :the following statement or first statement from the page generated by execMy.cgi? ;

May 5th, 2001 04:46
Colin Fraser, Yakov Simkin,


Try this simple experiment. In a page place this script and form. 
<SCRIPT LANGUAGE="JavaScript">
function thispage() {
   alert("I am in the original page")
}
</script>
<p> </p>
<form>
<input type="button" value="press here" 
onclick="location.href='mytestpage.htm'";thispage()>
</form>
Do not insert the location.href event script until after you are 
satisfied the alert works.  placing the 
The in the page named "mytestpage.htm" insert this script : 
<head>
<title>My Test Page</title>
<script language="JavaScript">
function thispage() {
   alert("I am in my test page")
}
</script>
</head>
<body onLoad="thispage()">
<h2>Test Page</h2>
</body>
You may want to  check the quote marks and make sure the semi-colon is 
correct. The answer to your question lies in the results here, however, 
this should be very obvious.