HI,
I'm a new to js and was hoping somebody could tell me if there is a command to change the HTML code while in NN. I found a post in this forum re:innerHTML and then found out it was IE specific.
I have a table consisting of a select box and text box. What I would like to do is add another <TR> with the same controls, triggered by the selectbox onchange event. After adding the new row w/the controls the selectbox options will be added using an array I create in the <BODY> onload event.
As I said before, I'm a newbie, so there is probably a better way to code then my example below. Please feel free to comment on that and any help re:adding the new row on the fly would be appreciated.
Thx in advance...Joe
<HTML>
<BODY onload=getDates()>
<form name="frmupside">
<table id ="tblUpside" align=center>
<tr>
<td>
<select name="selForPeriod"id="selForPeriod"</select><td>
</td>
<td>
<input name="txtForAmt" id="txtForAmt">
</td>
</tr>
</table>
</form>
</BODY>
</HTML>
<code>
<script language="JavaScript">
function getDates()
<!--
{
var today, todayy, todaym, todayd
var monthArray = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
var arDate = new Array()
today = new Date()
todayy = today.getYear()
todaym = today.getMonth()
todayd = today.getDate()
todayy = todayy + 1900
for (var i = 0; i <= 12; i++)
{
arDate =monthArray[todaym]+ "-" +todayy;
cdate = new Option(arDate, i, false, false)
document.frmupside.selForPeriod.options = cdate
if (todaym != 11){todaym = todaym + 1}
else{todaym = 0
todayy = todayy + 1 }
}
document.frmupside.selForPeriod.selectedIndex = 0
</script>
</code>
I'm a new to js and was hoping somebody could tell me if there is a command to change the HTML code while in NN. I found a post in this forum re:innerHTML and then found out it was IE specific.
I have a table consisting of a select box and text box. What I would like to do is add another <TR> with the same controls, triggered by the selectbox onchange event. After adding the new row w/the controls the selectbox options will be added using an array I create in the <BODY> onload event.
As I said before, I'm a newbie, so there is probably a better way to code then my example below. Please feel free to comment on that and any help re:adding the new row on the fly would be appreciated.
Thx in advance...Joe
<HTML>
<BODY onload=getDates()>
<form name="frmupside">
<table id ="tblUpside" align=center>
<tr>
<td>
<select name="selForPeriod"id="selForPeriod"</select><td>
</td>
<td>
<input name="txtForAmt" id="txtForAmt">
</td>
</tr>
</table>
</form>
</BODY>
</HTML>
<code>
<script language="JavaScript">
function getDates()
<!--
{
var today, todayy, todaym, todayd
var monthArray = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"
var arDate = new Array()
today = new Date()
todayy = today.getYear()
todaym = today.getMonth()
todayd = today.getDate()
todayy = todayy + 1900
for (var i = 0; i <= 12; i++)
{
arDate =monthArray[todaym]+ "-" +todayy;
cdate = new Option(arDate, i, false, false)
document.frmupside.selForPeriod.options = cdate
if (todaym != 11){todaym = todaym + 1}
else{todaym = 0
todayy = todayy + 1 }
}
document.frmupside.selForPeriod.selectedIndex = 0
</script>
</code>