G
Geniium
Hello,
Im looking to make work my script on both IE and Netscape. It works
fine in IE, but netscape cant handle "dynamic" variables. I need some
help!
Is there a CORRECT way to pass a string as parameter and then use it
as an object in Netscape? IE does that without problem... and Netscape
seems not able to handle it...
1. Here is the function :
function change_text(object, new_value){
if (document.all) { // IE
object.innerHTML = new_value;
} else { // Netscape => this DONT work
object = document.getElementById(object);
object.innerHTML = new_value;
}
}
2. and an exemple of script calling it :
change_text(divNameToChange, 'new html content);
I think u might see my problem... spent few hours looking here and
there, mainly on google... without success. tried many different
things to make the script work.
A workaround is to pass the full object (like
document.getElementById('divNameToChange')) to handle it on netscape,
but I have tonz of line of code using it, I dont want to change
manually all and its not a pretty way to do it.
If you got any idees, shoot!
Thanks!
Romain
PS: eval() seems not a good way to do it, and is not working.
Im looking to make work my script on both IE and Netscape. It works
fine in IE, but netscape cant handle "dynamic" variables. I need some
help!
Is there a CORRECT way to pass a string as parameter and then use it
as an object in Netscape? IE does that without problem... and Netscape
seems not able to handle it...
1. Here is the function :
function change_text(object, new_value){
if (document.all) { // IE
object.innerHTML = new_value;
} else { // Netscape => this DONT work
object = document.getElementById(object);
object.innerHTML = new_value;
}
}
2. and an exemple of script calling it :
change_text(divNameToChange, 'new html content);
I think u might see my problem... spent few hours looking here and
there, mainly on google... without success. tried many different
things to make the script work.
A workaround is to pass the full object (like
document.getElementById('divNameToChange')) to handle it on netscape,
but I have tonz of line of code using it, I dont want to change
manually all and its not a pretty way to do it.
If you got any idees, shoot!
Thanks!
Romain
PS: eval() seems not a good way to do it, and is not working.