PDA

View Full Version : Hard One: for me - changeing Onclick method values & text ON input button


BrightNail
05-02-2003, 08:28 PM
hey,

is there a way that is reliable in which you have a regular input button ala...

<input type="button" value="desc one" onClick="somefunction(var1,var2)">

but if a user "clicks" on it, its values change to some predefined array elements I have or a layer.not sure which...changes to -->


<input type="button" value="desc two" onClick="somefunction(diffvar1,diffvar2)">

and on and on...I am on one page, but stepping thru diff. sections..andI want the content (have that) and the button (don't have) to change

please advise.

tamienne
05-02-2003, 10:09 PM
<SCRIPT>
var currentIdx =0;
var aValues = new Array("val 1", "second val","3rd Val");

function getNextVal() {
currentIdx++;
currentIdx=currentIdx%(aValues.length);
return aValues[currentIdx];
}
</SCRIPT>
<FORM>
<INPUT TYPE="BUTTON" NAME="btn" VALUE="hi" onClick="this.value = getNextVal();">
</FORM>