[thelist] referencing js variables
Michael Pemberton
mpember at phreaker.net
Thu Aug 30 21:32:07 CDT 2001
Here's some code I wrote to extract the values from a url:
var tmpArgs=location.search.substring(1,
location.search.length).split(',');
window.args=[];
for (var i=0; i < tmpArgs.length; i++) {
var tmpArr=tmpArgs[i].split('=');
window.args[i]=window.args[unescape(tmpArr[0])]=unescape(tmpArr[1]);
return;
};
It simple creates an array so that window.args[variable]=value
Just run this code when the page has loaded and all your arguments
should now be accessible in the window.args array.
ALBIE ATTIAS wrote:
>
> I am currently trying to successfully create an online multiple choice quiz
> spanning several web pages using JavaScript to sore the user's answers and
> direct them appropriately at the end of the test. More specifically, I'm
> passing the user's answers from one page to the next using the get method
> within my form and then parsing the arguments from the URL. These arguments
> are then passed on to the next page as hidden form elements.
>
> The problem I have is that I don't know how to reference and manipulate the
> answers (that I've hopefully stored and passed on correctly) on the final
> page of the test.
>
> To illustrate this further, I've published my efforts so far on the web.
> Take a peek and you'll see what I'm trying to achieve.
>
> http://www.eurosimm.com/page1.htm
>
> Can anyone give me the crucial piece of coding I need to reference the
> user's answers on page 3?
>
>
> Regards
>
> Albie Attias
>
> IT Manager
>
> Eurosimm specialise in Memory, Hard Drives, Options & Solutions for Major
> Branded Systems
>
> Compaq / IBM / HP / Toshiba / Western Digital / Maxtor / Fujitsu / Hitachi /
> Seagate / Quantum
>
> E-Mail: albie at eurosimm.com <mailto:albie at eurosimm.com>
> Web: http://www.eurosimm.com <http://www.eurosimm.com/>
> Tel : +44 (0) 1706 360000
> Fax : +44 (0) 1706 620000
>
> AOL IM : AAEUROSIMM
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
--
Michael Pemberton
mpember at phreaker.net
ICQ: 12107010
More information about the thelist
mailing list