I am new to javascript, so bear with me. I have three embedded for() loops written in php, which echo code in javascript. The first two loops contain header-type text. The third loop contains a textbox which holds a numeric value specified by a variable. Something like this:
[code=php]
echo”var theVar0 = 100;”;
echo”var theVar1 = 123;”;
echo”var theVar2 = 198;”;
echo”var theVar3 = 129;”;
for($L1=0; $L1<3; $L1++){
echo”document.write(‘<br>HEADER 1’);n”;
for($L2=0; $L2<3; $L2++){
echo”document.write(‘<br>HEADER 2’);n”;
for($L3=0; $L3<3; $L3++){
echo”document.write(‘$<input type=”text” name=””.$L3.”_name” value=”‘+theVar”.$L3.”+'”>’);n”;
}
}
}
I need a way of making the values inside of the boxes change by 1% of their value when a button is clicked. Something like a button, which when pressed would call a function to perform “theVarX = theVarX + 0.01*theVarX”.
This must be possible using onClick (I can’t use <input> because this is all within a form), but I don’t know how.
Any ideas?