473,408 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Onclick not running on IE..Please someone help me..

Below is my code. It not running on IE..You may copy and try this code..
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" >
  4. <title>Untitled Document</title></head>
  5. <script language="JavaScript" type="text/javascript">
  6. var i=1;
  7. function addRow()
  8. {
  9.       var tbl = document.getElementById('table1');
  10.       var lastRow = tbl.rows.length;
  11.       var i = lastRow - 1;
  12.       var row = tbl.insertRow(lastRow);
  13.  
  14.       var firstCell = row.insertCell(0);
  15.       var select = document.createElement('select'); 
  16.       select.name = 'name_' + i;
  17.       select.id = 'name_' + i ;
  18.       select.class = 'post';
  19.  
  20.   select.innerHTML = document.getElementById('name_0').innerHTML;
  21.  
  22.  
  23.             firstCell.appendChild(select);
  24.  
  25.  
  26.       var secondCell = row.insertCell(1);
  27.       var el2 = document.createElement('input');
  28.       el2.type = 'text';
  29.       el2.name = 'address_' + i;
  30.       el2.id = 'address_' + i;
  31.       el2.size = 20;
  32.       el2.maxlength = 20;
  33.       secondCell.appendChild(el2);
  34.  
  35.       var thirdCell = row.insertCell(2);
  36.       var el3 = document.createElement('input');
  37.       el3.type = 'text';
  38.       el3.name = 'contactNum_' + i;
  39.       el3.id = 'contactNum_' + i;
  40.       el3.size = 20;
  41.       el3.maxlength = 20;
  42.       thirdCell.appendChild(el3);
  43.      // alert(i);
  44.       i++;
  45.       frm.h.value=i;
  46.     //  alert(i);
  47. }
  48. </script>
  49.  
  50. <body>
  51. <?php
  52. mysql_connect("localhost", "root", '')or die(mysql_error());
  53. mysql_select_db("test") or die(mysql_error());
  54. $num =  $_POST['h'];
  55. for($i=0;$i<$num;$i++)
  56. {
  57.  
  58.         $name       = $_POST["name_$i"];
  59.         $address    = $_POST["address_$i"];
  60.         $contactNum = $_POST["contactNum_$i"];
  61.  
  62. mysql_query("INSERT INTO `company`(`name`, `add`, `contact`) Values('$name', '$address', '$contactNum')") or die(mysql_error());
  63. }
  64.  
  65. ?>
  66.  
  67.  
  68.  
  69. <form  method="post" name="frm" id="frm">
  70. <table width="40%" border="2" cellpadding="0" cellspacing="0" id="table1">
  71.   <tr>
  72.     <td><strong>Name</strong></td>
  73.     <td><strong>Address</strong> </td>
  74.     <td><strong>Contact Num</strong> </td>
  75.   </tr>
  76. <tr>
  77.     <td><select class="post" name="name_0" id="name_0" >
  78.                <option >Supervisor Negeri</option>
  79.             <option >Pegawai Daftar</option>
  80.             <option >Pegawai Semak</option>
  81.             <option >Pegawai Pengesyoran</option>
  82.             <option >Pegawai Semak HQ</option>
  83.             <option >Pegawai Pemantau</option>
  84.                  </select>
  85.  
  86.  
  87. </td>
  88.     <td><input name="address_0" type="text" id="address_0" size="20" maxlength="20" /></td>
  89.     <td><input name="contactNum_0" type="text" id="contactNum_0" size="20" maxlength="12" /></td>
  90. </tr>
  91. </table>
  92. <input type="button" value="Add" onclick="addRow();" />
  93. <input name="Submit" type="submit" value="Submit" />
  94. <label>
  95. <input name="h" type="hidden" id="h" value="0" />
  96. </label>
  97. </form>
  98. </body>
  99. </html>
Jul 29 '13 #1
0 1293

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: mca | last post by:
When I try to read tokens from a text file, c# does not accept "-" (minus sign) as a valid token and tokenizer always throws exception. What should I do to make "-" sign valid Important note :...
1
by: Alessandro Rinaldi | last post by:
Hi all, what's wrong in this ? I added a simple Control with viewstate (ie : label, or my User control... ) dynamically in the controls collection of a TD cell created dynamically too, i lose...
1
by: momo | last post by:
Hello Guys, I have a bit of a problem, I created a Dll called SecureQueryStringDll.dll and I had the dll put bin folder of my application first and it did not work so I then put it in the bin...
3
by: chucher | last post by:
I´m developing a database in access about invoices that could use to different kinds of money (US Dollar and Pesos). I have a form where you can insert the invoices and de items of de invoice. I...
14
by: ThazKool | last post by:
I want to see if this code works the way it should on a Big-Endian system. Also if anyone has any ideas on how determine this at compile-time so that I use the right decoding or encoding...
2
by: jasonchan | last post by:
I am trying to have a function start with a timer and then switch to another function. However, it is not working at all. Anyone know whats goin on? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
12
by: OccasionalFlyer | last post by:
I am pretty new to JavaScript and having trouble with something that should, I think, be fairly easy. I have one form. I have two radio buttons. I have a text box that is hidden. If you click...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.