Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get values from one html document to other?

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I want to get the values from one document to other. I mean we r doing some on line quiz program. Suppose there is the Html document by the name ques.html. These contains questions. For every correct answer for each question i want to store the values in a variable and finally i need to pass the value to score.html. Is is possible to do in HTML/DHTML? Please help me.
 
You can move from the first document to your "score" document by using a little javascript function to tack on your question/answer pairs to the URL string:


function moveToScore() {
location.href="score.html?question1=something&answer1=something";
}

Of course, you'll have to concatenate the question/answer pairs in the URL string dynamically.

Then you can retrieve your values by parsing the return value of location.href:

function getValues()
{
values=location.href;
// Now parse the string for your question answer pairs
}

Another way is to use cookies to store your values. IMHO using cookies is a better approach.

HTH,

Russ
bobbitts@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top