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('la yer1', '<i>1st new base field</i>');
write_layer('la yer2', '<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(buil d){
if (build=='CORP') {
write_layer ('layer1', '<b>1st new corp field</b>');
}
else {
write_layer('la yer1', '<i>1st new base field</i>');
write_layer('la yer2', '<i>2nd new base field</i>');
}
}
function write_layer(thi slayer, texttoadd)
{
if (document.layer s) { // 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.getEl ementById) {
document.getEle mentById(thisla yer).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('la yer1', '<i>1st new base field</i>');
write_layer('la yer2', '<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(buil d){
if (build=='CORP') {
write_layer ('layer1', '<b>1st new corp field</b>');
}
else {
write_layer('la yer1', '<i>1st new base field</i>');
write_layer('la yer2', '<i>2nd new base field</i>');
}
}
function write_layer(thi slayer, texttoadd)
{
if (document.layer s) { // 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.getEl ementById) {
document.getEle mentById(thisla yer).innerHTML = texttoadd;
}
else {
document.write( "Layers are not understood by the browser");
}
}
Comment