473,406 Members | 2,343 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,406 software developers and data experts.

javascript onclick function not working in IE

am working with that code, when i click addrow button onclick function is not working in IE but working in mozilla, chrome

code is

<td><INPUT type="button" value="Add Row" onClick="addRow('dataTable')" class="btnExample" style="width:70px;"/></td>

<td><INPUT type="button" value="Delete Row" onClick="removeRow('dataTable')" class="btnExample" style="width:85px;"/></td>

</tr>
</table>

<table id="dataTable" style="margin-right:auto">

<tr>


<td>
<?php $result = mysql_query("select customer from customer"); echo "<select name = \"customervisit1\" style=\"width:125px;\">\n"; while ($row = mysql_fetch_assoc($result)) { echo '<option value = "'.$row[customer].'">'.$row[customer].'</option>';} echo "</select>"; ?>
</td>

<td><input type="checkbox" name="chk1[]" value="mon," style="width:65px;"></td>

<td width="29"><input type="checkbox" name="chk1[]" value="tue," style="width:65px;"></td>

<td width="35"><input type="checkbox" name="chk1[]" value="wed," style="width:65px;"></td>

<td width="31"><input type="checkbox" name="chk1[]" value="thu," style="width:65px;"></td>

<td width="24"><input type="checkbox" name="chk1[]" value="fri," style="width:65px;"></td>

<td width="140"><input class="input" type="text" name="pvdescription1" value="<?php if(isset($_POST['pvdescription'])) { echo $_POST['pvdescription'];} ?>" style="width:125px;" ></td>




</tr>



</table>


javascript function is

function addRow(tableID) {
var rowid = parseInt(document.getElementById('customerro').val ue)+1;

var content='';
content +='<td>';
content +='<select name="customervisit'+rowid+'" type="text" id="customervisit'+rowid+'" class="inputt" value = "" style="width:125px;">';
content +='<option value="" >-- select --</option>';
content +='<?php echo $customer; ?>';
content +='</select>';
content +='</td>';
content +='<td><input type="checkbox" name="chk'+rowid+'[]" value="mon," style="width:65px;"></td>';
content +='<td width="29"><input type="checkbox" name="chk'+rowid+'[]" value="tue," style="width:65px;"></td>';
content +='<td width="35"><input type="checkbox" name="chk'+rowid+'[]" value="wed," style="width:65px;"></td>';
content +='<td width="31"><input type="checkbox" name="chk'+rowid+'[]" value="thu," style="width:65px;"></td>';
content +='<td width="24"><input type="checkbox" name="chk'+rowid+'[]" value="fri," style="width:65px;"></td>';
content +='<td width="140"><input type="text" class="input" name="pvdescription'+rowid+'" value="" style="width:125px;" ></td>';
content +='';
document.getElementById('customerro').value = rowid;
var table = document.getElementById(tableID);

var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
row.innerHTML = content;
}
function removeRow(tableID)
{
// grab the element again!
var tbl = document.getElementById(tableID);
// grab the length!
var lastRow = tbl.rows.length;
// delete the last row if there is more than one row!
if (lastRow > 1) tbl.deleteRow(lastRow - 1);

var rowid = parseInt(document.getElementById('customerro').val ue)-1

document.getElementById('customerro').value = rowid;
}
</script>
Dec 31 '10 #1
3 7872
RamananKalirajan
608 512MB
Hi,
Please update ur code like the below one.

Expand|Select|Wrap|Line Numbers
  1. var rowCount = table.rows.length;
  2. var row = table.insertRow(rowCount);
  3. row.innerHTML = content;
  4. if(window.ActiveXObject)
  5.    row.innerHTML = row.innerHTML;
  6. }
It's not a proper way to do. But this will help ur problem. This is to refresh the container.

Thanks and Regards
Ramanan Kalirajan
Jan 3 '11 #2
ramanan, Thanks for yr reply its also not working in IE but i have changed my code like below


content1 ='<select name="customervisit'+rowid+'" type="text" id="customervisit'+rowid+'" class="inputt" value = "" style="width:125px;">';
content1 +='<option value="" >-- select --</option>';
content1 +='<?php echo $customer; ?>';
content1 +='</select>';

content2 ='<input type="checkbox" name="chk'+rowid+'[]" value="mon," style="width:65px;">';
content3 ='<input type="checkbox" name="chk'+rowid+'[]" value="tue," style="width:65px;">';
content4 ='<input type="checkbox" name="chk'+rowid+'[]" value="wed," style="width:65px;">';
content5 ='<input type="checkbox" name="chk'+rowid+'[]" value="thu," style="width:65px;">';
content6 ='<input type="checkbox" name="chk'+rowid+'[]" value="fri," style="width:65px;">';
content7 ='<input type="text" class="input" name="pvdescription'+rowid+'" value="" style="width:125px;" >';


var rowCount = table.rows.length;
var newRow = table.insertRow(rowCount);

newCell = newRow.insertCell(0)
newCell.innerHTML = content1

newCell = newRow.insertCell(1)
newCell.innerHTML = content2

newCell = newRow.insertCell(2)
newCell.innerHTML = content3

newCell = newRow.insertCell(3)
newCell.innerHTML = content4

newCell = newRow.insertCell(4)
newCell.innerHTML = content5

newCell = newRow.insertCell(5)
newCell.innerHTML = content6

newCell = newRow.insertCell(6)
newCell.innerHTML = content7
Its working properly,

once again thanks
Jan 3 '11 #3
RamananKalirajan
608 512MB
Glad that you fixed by yourself. Great! Keep going.

Thanks and Regards
Ramanan Kalirajan
Jan 3 '11 #4

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

Similar topics

0
by: malcolm | last post by:
How do I get a web-browser loaded with on-the-fly content and a JavaScript onclick popup function to work? I've embedded an axWebBrowser in my (vb.net) application. The browser starts with...
2
by: Asad | last post by:
I have a main window that creates a new window called printWin (which contains the printable format of the page). From the main window I embed a javascript in the printWin window that calls the...
2
by: jdub | last post by:
I bringing up a list of movies in a separate window where each one has an "onclick" function which is suppose to call a procedure and pass in the variables and display the details of the selected...
6
by: Nx | last post by:
i've got it all working nicely in firefox, but whenever i test it in IE none of the onclick events are triggered. i'm using an xsl to transform an rss feed into a photogallery. when i try to...
10
by: ljlolel | last post by:
So.. I have a form that submits to an ASP.net site made in C-sharp. The ASP site is not mine, i do not have the server side code. When I submit from my form by pressing the Submit button, I get...
10
by: NeoTubNinja | last post by:
I have a select statement with various numbers. Upon clicking on one of the options, you are sent to a page that puts the option value in a session and returns back to the previous page. When it...
1
by: grantmx | last post by:
Hey guys - We am having problems with the following code in our form: <tr><td></td><td align=right><input type="image" name="_ctl25:btnSaveLarge" onclick="if (typeof(Page_ClientValidate) ==...
4
by: Aaron Gray | last post by:
The following input checkbox onclick via DOM is not working on IE7, FF, or WebKit, but is working on Opera for some strange reason. http://www.aarongray.org/Test/JavaScript/checkbox.html ...
1
omerbutt
by: omerbutt | last post by:
hi i am trying to bond an onclick function of jGrowl but it is not working iit was initially used as the document ready function and i am changing it to use it on click here is the code <!DOCTYPE...
22
risk32
by: risk32 | last post by:
Hi all. I have a problem with an onClick function working when I click a button. The infamous IE error reporting links it back to the button itself, but I don't think that's the case (Line 48, 49 -...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.