Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compatible NN command to IE's "inner/outerHTML"

Status
Not open for further replies.

finny

Programmer
Nov 16, 2000
58
US
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=&quot;frmupside&quot;>

<table id =&quot;tblUpside&quot; align=center>
<tr>
<td>
<select name=&quot;selForPeriod&quot;id=&quot;selForPeriod&quot;</select><td>
</td>

<td>
<input name=&quot;txtForAmt&quot; id=&quot;txtForAmt&quot;>
</td>
</tr>
</table>

</form>
</BODY>
</HTML>
<code>
<script language=&quot;JavaScript&quot;>
function getDates()
<!--
{

var today, todayy, todaym, todayd
var monthArray = new Array(&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot;, &quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;,
&quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;, &quot;Dec&quot;)
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]+ &quot;-&quot; +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>

 
Netscape (until version 6.0) does not have support for innerHTML, you need to show and hide absolutely positioned elements (layers), and or write to these layers to change the contents. jared@aauser.com
 
Agreed, what you want to do is write() to either the document or your layers. You can also play with the .src of layers.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
yes, and also, you can use a server side language
 
thx for the responses. I'll play around and see what I can do...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top