473,383 Members | 1,953 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,383 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 2268
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.