I have one table which is generated using javascript dynamically.
In have write one function which creates table dynamically
for IE i have writed
mytable.onClick=some_function();
for onclick event it works fine.
But when i generate more than one table dynamically using the same function then onclick does not work. If anyone have solution please reply asap. Thanx for spending your precious time.

Usually the simplest thing to do is to click on the yellow ! icon in the bottom left of the browser window in IE. This will tell you the error. Better still, use Firefox and use the error console.

We can't see your code, so thats the best I can do.


Matti Ressler
Suomedia

I agree. use the error console in firefox. most times, if it works in FF, it'll work in IE.

It works Very good in FireFox and Opera but in ie how ever it doesnot work for multiple objects

I have writed My code below for better understanding.This code works fine for one object but for more than one object it does not work or no error is occur.

function getNodeTable(ip){
	//alert("IE getNode Table");
	var nodeTable=document.createElement("TABLE");
	nodeTable.align='center';
	var nodebody=document.createElement("TBODY");
	var tableRow,tableCell;
	nodebody.id='body'+ip;
	nodeTable.appendChild(nodebody);
	nodeTable.border=0;
	nodeTable.id=ip;
	nodeTable.name=ip;
	tableRow=document.createElement("TR");
	tableCell=document.createElement("TD");
	tableCell.align='center';
	tableCell.innerHTML='<img src=../images/waiting.gif height=62 width=88>';
	tableRow.appendChild(tableCell);
	nodebody.appendChild(tableRow);
	tableRow=document.createElement("TR");
	tableCell=document.createElement("TD");
	tableCell.innerHTML='<div color=white align=center>Gathering Information <img src=../images/ajax-loader.gif></div>';//replace with actual message
	tableRow.appendChild(tableCell);
	nodebody.appendChild(tableRow);
	var ipbkup="'"+ip+"'";
	nodeTable.setAttribute('onClick','sendToServe('+ipbkup+')');//generic method in ajaxcode.js
	nodeTable.onMouseOver="javascript:this.style.cursor='pointer'";
	nodeTable.onLoad=sendRequestToServer(nodeTable,ip);
	var newCell=document.createElement("DIV");
	newCell.appendChild(nodeTable);
	return newCell;
}

I have found the bug. Thanx for your help. My function gives me table in a div and i forgot to remove div while appending it to the document. I have writed code for only one object and it was not there for multiple object so that was the problem. Thanx for spending your valuable time friends.

I have one table which is generated using javascript dynamically.
In have write one function which creates table dynamically
for IE i have writed
mytable.onClick=some_function();
for onclick event it works fine.
But when i generate more than one table dynamically using the same function then onclick does not work. If anyone have solution please reply asap. Thanx for spending your precious time.

I have the same problem. Have you found a solution?

For IE Go for it

chbk.onclick = function(){urFunctionName();};

For Firfox Go For it

chbk.setAttribute('onClick','urFunctionName()');
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.