R
Red Ogden
The following script returns an error saying document.all is null or
not an object when I try to call the write_layer function more than
once within the same else statement i.e.:
else {
write_layer('layer1', '<i>1st new base field</i>');
write_layer('layer2', '<i>2nd new base field</i>');
Id be grateful if anyone can advise me on how to get it to call
multiple times inserting dynamic content in various <div> layers
depending on the build variable value.
Many thanks in advance
Redge
===============script=====================================
function build_text(build){
if (build=='CORP'){
write_layer ('layer1', '<b>1st new corp field</b>');
}
else {
write_layer('layer1', '<i>1st new base field</i>');
write_layer('layer2', '<i>2nd new base field</i>');
}
}
function write_layer(thislayer, texttoadd)
{
if (document.layers) { // for Netscape 4
document[thislayer].document.open(); // first you have to open
the layer
document[thislayer].document.write(texttoadd); // then you
write to it
document[thislayer].document.close(); // then you have to
close it
}
else if (document.all) {
document.all[thislayer].innerHTML = texttoadd; // with MSIE
you can use innerHTML
// document.all[thislayer].innerHTML += "texttoadd"; // you can
also append text to the current text in the layer"
}
else if (document.getElementById) {
document.getElementById(thislayer).innerHTML = texttoadd;
}
else {
document.write("Layers are not understood by the browser");
}
}
not an object when I try to call the write_layer function more than
once within the same else statement i.e.:
else {
write_layer('layer1', '<i>1st new base field</i>');
write_layer('layer2', '<i>2nd new base field</i>');
Id be grateful if anyone can advise me on how to get it to call
multiple times inserting dynamic content in various <div> layers
depending on the build variable value.
Many thanks in advance
Redge
===============script=====================================
function build_text(build){
if (build=='CORP'){
write_layer ('layer1', '<b>1st new corp field</b>');
}
else {
write_layer('layer1', '<i>1st new base field</i>');
write_layer('layer2', '<i>2nd new base field</i>');
}
}
function write_layer(thislayer, texttoadd)
{
if (document.layers) { // for Netscape 4
document[thislayer].document.open(); // first you have to open
the layer
document[thislayer].document.write(texttoadd); // then you
write to it
document[thislayer].document.close(); // then you have to
close it
}
else if (document.all) {
document.all[thislayer].innerHTML = texttoadd; // with MSIE
you can use innerHTML
// document.all[thislayer].innerHTML += "texttoadd"; // you can
also append text to the current text in the layer"
}
else if (document.getElementById) {
document.getElementById(thislayer).innerHTML = texttoadd;
}
else {
document.write("Layers are not understood by the browser");
}
}