Page 1 of 1

Javascript Help

Posted: 15 Mar 2011, 10:44
by Mandro
Hi guys!

I have a four step html form that i have coded but what i need to try and figure out is the following:

I have a basic unordered list menu at the top of the page:

<ul>
<li>STEP 1:</li>
<li>STEP 2:</li>
<li>STEP 3:</li>
<li>STEP 4:</li>
</ul>

and what i want to happen is when the user is on "Step 1" the list item should be a certain css class so that the user know they are now on step 1 of 4 and then as they move on through the form that particular css class moves through the unordered list.

Hope the above makes sense, please help!

Re: Javascript Help

Posted: 15 Mar 2011, 20:21
by -Prometheus-
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................
........................................................................................................................................................................................................

Re: Javascript Help

Posted: 15 Mar 2011, 20:45
by DeathStrike
hmmm. need more info...

you will need to give each li an id

eg.

Code: Select all

<li id="li1">STEP 1:</li>
then you call it

Code: Select all

<script language="javascript">
function test(){
document.formname.li1.class = "classname";
}
</script>
very roughly done.