473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

error calling function more than once within else

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");
}

}
Jul 20 '05 #1
1 2269
Red Ogden wrote:
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.

<SNIP>
I was unable to reproduce the problem under IE6. Suggets you check that
the 'layer2' DIV actually has and id value of 'layer2', and that it is
defined before calling the build_text() function ... still coming down
the wire won't do :)

Cheers,
Dom

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: limelight | last post by:
I have discovered a math error in the .NET framework's Log function. It returns incorrect results for varying powers of 2 that depend on whether the program is run from within the IDE or from the...
7
by: Steve Jorgensen | last post by:
Here is some code to generate code for raising and getting information about custom errors in an application. Executing the GenerateXyzErrDefs procedure generates the code. <tblXyzError>...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
2
by: Steve Richfield | last post by:
My error handler works GREAT. However, VBA seems to have some bugs/features that are causing it fits. The little snippet that I put at the end of each routine looks like this: Error_Handler: If...
11
by: suzy | last post by:
i am trying to write aspx login system and the login process requires a validity check of username and password. i have been told that raising exception is costly, but i want a custom error...
5
by: Kurt Van Campenhout | last post by:
Hi, I am trying to get/set Terminal server information in the active directory on a windows 2000 domain. Since the ADSI calls for TS don't work until W2K3, I need to do it myself. I'm fairly...
7
by: jacob navia | last post by:
Microsoft proposed recently (In the Technical Report 24173 presented to the Standards Comitee) a change in the C library in the sense of more security. Basically, missing size information is...
0
by: erik.erikson | last post by:
I am getting a compiler error that I can't well explain or even understand the origin of (though I boiled it down close...). Below is a bare-bones example. What I am doing is defining the...
47
by: teju | last post by:
hi, i am trying 2 merge 2 projects into one project.One project is using c language and the other one is using c++ code. both are working very fine independently.But now i need to merge both...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.