Hi!
I am trying to add Html code dynamically to my web form with a js function, but I can’t. I want to add a new row with columns and form objects, and I am trying to do it thus:
The js function:
[code]
function check_Prod() {
var prod = document.form_newProd.product.value
switch(prod) {
case “22”:
[B]var otherProd = document.getElementById(‘others’);[/B]
otherProd.innerHTML = “<tr><td height=’30’ colspan=’2′ align=’center’></td><td colspan=’4′><span id=’otherP’ class=’letter4′><span id=’ast’ class=’RedAst’>*</span> Specify the Product:</span> <input type=’text’ name=’writeProd’ class=’letter1′></td></tr>”;
break;
case “27”:
[B]var otherProd = document.getElementById(‘others’);[/B]
otherProd.innerHTML = “<tr><td height=’30’ colspan=’2′ align=’center’></td><td colspan=’4′><span id=’otherP’ class=’letter4′><span id=’ast’ class=’RedAst’>*</span> Specify the Product:</span> <input type=’text’ name=’writeProd’ class=’letter1′></td></tr>”;
break;
…
default:
[B]var otherProd = document.getElementById(‘others’);[/B]
otherProd.innerHTML = “”;
}
}
The ‘product’ select object:
[code]
<select name=”product” onChange=”return check_Prod()”></select>
And inside the table:
[code]
…
<td><input type=”text” name=”type”></td>
</tr>
[B]<span id=”others”></span>[/B]
<tr>
<td height=”30″ align=”left” valign=”middle” class=”letter4″><span class=”redAst”>*</span> Offer Title: </td>
…
None error appears, but the Html code is not added, simply nothing happens..
What is wrong?
Thank you