javascript help needed to solve problem in create input text filedcontinuously?

  • Thread starter Amit Prakash Pawar
  • Start date
A

Amit Prakash Pawar

Hi,
I am writing code to create new text filed dynamically.
But after create 2 or 3 it stops.
Not creating continuously.
How to solve this??

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<SCRIPT language="javascript">

function GenerateRow(rowid){


str = '<tr>';
str = str + '<td width="7" align="left" valign="top"><img src="images/
cor-topLeft.gif" width="7" height="6" alt=""/></td>';
str = str + '<td width="894"></td>';
str = str + '<td width="8" align="right" valign="top"><img
src="images/cor-topRight.gif" width="7" height="6" alt=""/></td>';
str = str + '</tr>';
str = str + '<tr>';
str = str + ' <td></td>';
str = str + ' <td class="formText">';
str = str + ' <input name="textfield10" type="text"
class="inputText" id="textfield10" size="20" />';
str = str + ' @yourdomain.com points to';
str = str + ' <select name="select3" class="dropDown"
id="select3">';
str = str + ' <option>Select</option>';
str = str + ' <option selected="selected">miles</option>';
str = str + ' </select>@yourdomain.com</td>';

str = str + '<td></td>';
str = str + '</tr>';
str = str + '<tr>';
str = str + ' <td align="left" valign="bottom"><img src="images/cor-
botLeft.gif" width="7" height="6" alt=""/></td>';
str = str + ' <td></td>';
str = str + ' <td align="right" valign="bottom"><img src="images/cor-
botRight.gif" width="7" height="6" alt=""/></td>';
str = str + ' </tr>';

return str;
}


function AddLastRow(){

var htm = document.getElementById("service_table").innerHTML;

var tbl = '<table border="0" cellpadding="0" cellspacing="0"
bgcolor="#d2e8fd" width="909" id="tbl1">';


var tbl;
var tbl2="";

if(htm ==""){
tbl2 = tbl2 + GenerateRow(1);

}
else{
tbl2 = "";
var obj = document.getElementById("tbl1")
var trobj = obj.getElementsByTagName("tr");

for(i=0;i<trobj.length;i++)
{
tbl2 = tbl2 + "<tr bgcolor='#d2e8fd'>"
tbl2 = tbl2 + trobj.innerHTML
tbl2 = tbl2 + "</tr>"
}
//tbl = tbl+tbl2;
len = trobj.length;
len = len +1;

tbl2 = tbl2 + GenerateRow()

len = len +1;

}
tbl = tbl + tbl2 + "</table>";
//alert(tbl)
document.getElementById("service_table").innerHTML=tbl;
}
</SCRIPT>
</head>

<body>
<table width="909" border="0" cellpadding="0" cellspacing="0"
bgcolor="#d2e8fd" id="tbl1">
<tr>
<td width="7" align="left" valign="top"><img src="images/cor-
topLeft.gif" width="7" height="6" alt=""/></td>
<td width="894">&nbsp;</td>
<td width="8" align="right" valign="top"><img src="images/cor-
topRight.gif" width="7" height="6" alt=""/></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="formText">
<input name="textfield10" type="text" class="inputText"
id="textfield10" size="20" />
@yourdomain.com points to
<select name="select3" class="dropDown" id="select3">
<option>Select</option>
<option selected="selected">miles</option>
</select>
@yourdomain.com</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="left" valign="bottom"><img src="images/cor-botLeft.gif"
width="7" height="6" alt=""/></td>
<td>&nbsp;</td>
<td align="right" valign="bottom"><img src="images/cor-
botRight.gif" width="7" height="6" alt=""/></td>
</tr>
</table>
<div id='service_table'></div>

<table width="924" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="754">&nbsp;</td>
<td width="108" class="addUser"><strong>Add email alias</strong></
td>

</tr>
</table>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top