943,699 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 528
  • PHP RSS
Sep 8th, 2009
0

problem to create input text continiously?

Expand Post »
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??

PHP Syntax (Toggle Plain Text)
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <title>Untitled Document</title>
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  7. <SCRIPT language="javascript">
  8.  
  9. function GenerateRow(rowid){
  10.  
  11.  
  12. str = '<tr>';
  13. str = str + '<td width="7" align="left" valign="top"><img src="images/cor-topLeft.gif" width="7" height="6" alt=""/></td>';
  14. str = str + '<td width="894"></td>';
  15. str = str + '<td width="8" align="right" valign="top"><img src="images/cor-topRight.gif" width="7" height="6" alt=""/></td>';
  16. str = str + '</tr>';
  17. str = str + '<tr>';
  18. str = str + ' <td></td>';
  19. str = str + ' <td class="formText">';
  20. str = str + ' <input name="textfield10" type="text" class="inputText" id="textfield10" size="20" />';
  21. str = str + ' @yourdomain.com points to';
  22. str = str + ' <select name="select3" class="dropDown" id="select3">';
  23. str = str + ' <option>Select</option>';
  24. str = str + ' <option selected="selected">miles</option>';
  25. str = str + ' </select>@yourdomain.com</td>';
  26.  
  27. str = str + '<td></td>';
  28. str = str + '</tr>';
  29. str = str + '<tr>';
  30. str = str + ' <td align="left" valign="bottom"><img src="images/cor-botLeft.gif" width="7" height="6" alt=""/></td>';
  31. str = str + ' <td></td>';
  32. str = str + ' <td align="right" valign="bottom"><img src="images/cor-botRight.gif" width="7" height="6" alt=""/></td>';
  33. str = str + ' </tr>';
  34.  
  35. return str;
  36. }
  37.  
  38.  
  39. function AddLastRow(){
  40.  
  41. var htm = document.getElementById("service_table").innerHTML;
  42.  
  43. var tbl = '<table border="0" cellpadding="0" cellspacing="0" bgcolor="#d2e8fd" width="909" id="tbl1">';
  44.  
  45.  
  46. var tbl;
  47. var tbl2="";
  48.  
  49. if(htm ==""){
  50. tbl2 = tbl2 + GenerateRow(1);
  51.  
  52. }
  53. else{
  54. tbl2 = "";
  55. var obj = document.getElementById("tbl1")
  56. var trobj = obj.getElementsByTagName("tr");
  57.  
  58. for(i=0;i<trobj.length;i++)
  59. {
  60. tbl2 = tbl2 + "<tr bgcolor='#d2e8fd'>"
  61. tbl2 = tbl2 + trobj[i].innerHTML
  62. tbl2 = tbl2 + "</tr>"
  63. }
  64. //tbl = tbl+tbl2;
  65. len = trobj.length;
  66. len = len +1;
  67.  
  68. tbl2 = tbl2 + GenerateRow()
  69.  
  70. len = len +1;
  71.  
  72. }
  73. tbl = tbl + tbl2 + "</table>";
  74. //alert(tbl)
  75. document.getElementById("service_table").innerHTML=tbl;
  76. }
  77. </SCRIPT>
  78. </head>
  79.  
  80. <body>
  81. <table width="909" border="0" cellpadding="0" cellspacing="0" bgcolor="#d2e8fd" id="tbl1">
  82. <tr>
  83. <td width="7" align="left" valign="top"><img src="images/cor-topLeft.gif" width="7" height="6" alt=""/></td>
  84. <td width="894">&nbsp;</td>
  85. <td width="8" align="right" valign="top"><img src="images/cor-topRight.gif" width="7" height="6" alt=""/></td>
  86. </tr>
  87. <tr>
  88. <td>&nbsp;</td>
  89. <td class="formText">
  90. <input name="textfield10" type="text" class="inputText" id="textfield10" size="20" />
  91. @yourdomain.com points to
  92. <select name="select3" class="dropDown" id="select3">
  93. <option>Select</option>
  94. <option selected="selected">miles</option>
  95. </select>
  96. @yourdomain.com</td>
  97. <td>&nbsp;</td>
  98. </tr>
  99. <tr>
  100. <td align="left" valign="bottom"><img src="images/cor-botLeft.gif" width="7" height="6" alt=""/></td>
  101. <td>&nbsp;</td>
  102. <td align="right" valign="bottom"><img src="images/cor-botRight.gif" width="7" height="6" alt=""/></td>
  103. </tr>
  104. </table>
  105. <div id='service_table'></div>
  106.  
  107. <table width="924" border="0" cellspacing="0" cellpadding="0">
  108. <tr>
  109. <td width="754">&nbsp;</td>
  110. <td width="108" class="addUser"><strong>Add email alias</strong></td>
  111. <td width="62">
  112. <img src="images/plus.gif" alt="Add User" onclick="AddLastRow();"/></td>
  113.  
  114. </tr>
  115. </table>
  116. </body>
  117. </html>
Similar Threads
Reputation Points: 3
Solved Threads: 15
Posting Whiz
Aamit is offline Offline
341 posts
since Apr 2008
Sep 8th, 2009
0

Re: problem to create input text continiously?

I must admit that javascript is not my strong suit, but I will try to help. The line
html Syntax (Toggle Plain Text)
  1. tbl2 = tbl2 + GenerateRow()
What happens in javascript if you call a function without the parameter in the method signature? Also you appear to be missing several ;'s to end your statements, not sure what effect this might have?
Reputation Points: 395
Solved Threads: 192
Veteran Poster
darkagn is offline Offline
1,136 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: problem with remembering selected drop down option
Next Thread in PHP Forum Timeline: Display Number of Times X Value is Empty





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC