View Single Post
  #1 (permalink)  
Old 09-08-2007, 09:36 PM
icesha icesha is offline
Registered User
 
Join Date: Sep 2007
Posts: 1
Javascript: How to pass variable from one page to another

Hi. I just want to ask how can i pass variable from a page to another using query string. I have to score a specific quiz. Wherein, I have to calculate the score from a page to another. The event that will trigger it is a button. If the answer is correct, add 10 points if not, no point should be added and score should be shown at the last page. here is an example of my code.
please help me. i'm new in using javascript. thanks.

function incorrect()
{
alert("OOPS! Bad Answer! Your Answer is incorrect!!");
window.close("http://localhost/xampp/ECSEL/newecsel/exercisestest.php")
window.open("http://localhost/xampp/ECSEL/newecsel/exercisestest1.php?score=0")

}
function correct()
{
alert("GOOD WORK!! The answer Compound Sentence is correct. ");
alert("This is a compound sentence, because it contains two independent clauses joined by the co-ordinating conjunction AND.");
window.close("http://localhost/xampp/ECSEL/newecsel/exercisestest.php")
window.open("http://localhost/xampp/ECSEL/newecsel/exercisestest1.php?score=10")
}


<%
Response.Write(Request.QueryString)
Response.Write(Request.QueryString("score"))
%>
Reply With Quote