#1 (permalink)  
Old 09-08-2007, 09:36 PM
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

  #2 (permalink)  
Old 09-09-2007, 09:24 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,445
I'm really confused about how you're doing things.

Your form actions lead to PHP files, but the way your javascript is written, it appears as though you are using ASP/server-side javascript to process parts of it.

Why do you need javascript at all? If you are using PHP to process the form, why not tally the score using PHP? You could do so by using either hidden form fields or by generating and editing cookies.
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
paging with JavaScript and ASP "Next" "Previous" gilgalbiblewhee Programming and Scripting 1 07-05-2007 10:19 AM
javascript: html page array with an iframe Epsilon Programming and Scripting 4 05-10-2007 06:50 PM
Javascript page printing.. yuppicide Programming and Scripting 2 02-16-2007 03:22 PM
javascript for redirecting iFrame page gilgalbiblewhee Programming and Scripting 0 08-29-2006 02:36 PM
controling load order of swfs and jpgs on an html page, maybe javascript? NaradaVantari Graphics and Flash 3 04-28-2005 08:42 PM


All times are GMT -5. The time now is 01:52 PM.

 
Bitrix
Clicky Web Analytics
CloudContacts
Maxtango


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter