I am dynamically adding rows to a table, and each row have a button which
removes it.
I have successfully implemented this for mozilla but I'm having troubles
with IE, here is how I did it:
Each new row's id is an index number, each button's name is the row's id,
and I'm adding this function as the click event listener for the button:
function removeline(even t){
var row=document.ge tElementById("r ow" + event.target.na me);
var tbody=document. getElementById( "items");
var olds=tbody.styl e.display;
tbody.style.dis play="none";
tbody.removeChi ld(row);
tbody.style.dis play=olds;
}
I'm adding it this way:
var newbutton=docum ent.createEleme nt("INPUT");
newbutton.type= "button";
newbutton.value ="Remove";
newbutton.id=ro wcount;
newbutton.name= rowcount;
if(navigator.us erAgent.match(" MSIE")) // for IE compatibility
newbutton.attac hEvent("onclick ",removelin e);
else
newbutton.addEv entListener("cl ick",removeline ,false);
But IE doesn't pass nothing as a parameter for removeline().
Any suggestions?
Thanks,
-Amir.
--
Remove the 'dont_spam_me' and the dashes before mailing me.
removes it.
I have successfully implemented this for mozilla but I'm having troubles
with IE, here is how I did it:
Each new row's id is an index number, each button's name is the row's id,
and I'm adding this function as the click event listener for the button:
function removeline(even t){
var row=document.ge tElementById("r ow" + event.target.na me);
var tbody=document. getElementById( "items");
var olds=tbody.styl e.display;
tbody.style.dis play="none";
tbody.removeChi ld(row);
tbody.style.dis play=olds;
}
I'm adding it this way:
var newbutton=docum ent.createEleme nt("INPUT");
newbutton.type= "button";
newbutton.value ="Remove";
newbutton.id=ro wcount;
newbutton.name= rowcount;
if(navigator.us erAgent.match(" MSIE")) // for IE compatibility
newbutton.attac hEvent("onclick ",removelin e);
else
newbutton.addEv entListener("cl ick",removeline ,false);
But IE doesn't pass nothing as a parameter for removeline().
Any suggestions?
Thanks,
-Amir.
--
Remove the 'dont_spam_me' and the dashes before mailing me.
Comment