Hi friends,
Please help me with this, any javascript guy, Please >
this script is working in every browser except Internet Explorer.
It says an unknown runtime error ? :(

<script language="javascript">
var count=1;
function extend()
{
var a = "sname";
var b = "sgender";
var c = "sbranch";
var d = "sevents";
var formholder ="<tr><td>"+count+"</td><td></td><td><input type=text name="+a+count+" size=20 maxlength=150 ></td><td><input type=text name="+b+count+" size=5 maxlength=1 ></td><td><input type=text name="+c+count+" size=20 maxlength=150 ></td><td><input type=text name="+d+count+" size=35 maxlength=250 ></td></tr>";
ge = document.getElementById('abc');
ge.innerHTML += formholder;
count++;
}
</script>

HELP !!

Nothing immediately wrong but I suggest :

  • Avoid "extend". It's just possibly a reserved word (even though it's not part of the javascript language).
  • I guess that element '#abc' is a table. Try using <tbody id="abc">...</tbody> inside the table and add your row to it rather than directly to the table.
  • Use DOM methods to add the row rather than .html += . With this approach you will certainly need a <tbody>.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.