multi-step script

Giganews Newsgroups
Subject: multi-step script
Posted by:  Andrew V. Romero (rrstudi…@icqmail.com)
Date: Mon, 07 Jul 2003

First off, I am mostly familier with PHP but am trying to make a
multi-step javascript program.  For an example, I would like to run
different sections of the script depending on how many times the user
presses the submit button:

<form method="post" name="step1" action="test.html">

<script language="JavaScript">

var position
if (! position)
{
    alert("Position0")
    document.write("<input type = \"hidden\" name = \"position\" value =
\"1\">")
    document.close()
}

if (position=1)
{
    alert("Position1")
    document.write("<input type = \"hidden\" name = \"position\" value =
\"2\">")
}

</script>

<div align=right><br><input TYPE = "submit" Value = "  Next
"></div></form>

I keep running into problems...for example, javascript doesn't have an
isset command that I know of, so I can't just use hidden elements to
determine what part of the script to run.  I tried using form method get
to use variables in the location to determine which parts run, but I am
not sure how to pull the variables out of the location bar using
javascript.  I think I am trying to make this more complex than it
is...what is the best way to go about this?

Replies