473,406 Members | 2,698 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,406 software developers and data experts.

No Errors, But No Page

Hello,

I've written--what should have been--a small simple script...if getElementById, then xzy, else abc. The then, else portion calls a doc.write which scripts a js-include. For testing purposes, the called includes are simple alert-messages.

The script runs fine, error free, and the js-includes are scripted--and the alerts fire.

The problem is: I get no page back after OK-ing the alert-msg; I'm left with a blank--nothing but white...the content of my page does not come back into view. The blank problem occurs in all browsers. I'm sure the solution is simple, but I'm not developer enough to figure-it-out.

Here's the code:

if (navigator.cookieEnabled != 0) {
if (document.getElementById) {
onload = function() {
myThing();
}
}
function myThing() {
var js = document.getElementById('jsOn');
if (document.getElementById) {
if (js.style.visibility != 'hidden') {
jsLaunch('~JS/jsLaunch.js');
}
else {
jsToggle('~JS/jsToggle.js');
}
}
}
}
function jsLaunch(url) {
if (!document.layers) {
document.write('<script src="', url, '" type="text/javascript"><\/script>');
}
}
function jsToggle(url) {
if (!document.layers) {
document.write('<script src="', url, '" type="text/javascript"><\/script>');
}
}

If someone can spot the problem, please inform me.
Thank you,
Nunajer
Apr 30 '07 #1
2 1176
iam_clint
1,208 Expert 1GB
first problem

Expand|Select|Wrap|Line Numbers
  1. if (document.getElementById) {
  2. onload = function() {
  3. myThing();
  4. }
  5.  
needs to be

Expand|Select|Wrap|Line Numbers
  1. if (document.getElementById) {
  2. window.onload = function() {
  3. myThing();
  4. }
  5.  

and i'm not even sure if you can write <script src= "" > to the page after it has loaded infact i'm pretty sure you can't.
Apr 30 '07 #2
Thank you very much...

FYI: adding window. to onload didn't solve the problem.
Thus, you must be right about not being able to doc.write <script> after loading.

So, I fixed the prob. via DHTML:

function jsLaunch(url) {
if (document.getElementsByTagName) {
var el = document.createElement("script");
el.src = url;
el.type="text/javascript";
document.getElementsByTagName("head")[0].appendChild(el);
}
}

Again, thank you.
Nunajer
Apr 30 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Michelle Kinsey-Clinton | last post by:
Hello, I am writing an ASP app which is giving me some very frustrating errors. They appear intermittently, no real pattern to them, and often go away if you reload, or back up a few pages and...
1
by: Ersin Gençtürk | last post by:
We couldn't find why these errors happen.They doesn't appear everytime.And they appear different pages at different times.Is there somebody know why these happenes ? First user gets this error :...
2
by: Marty McDonald | last post by:
Many of our apps are in production and they do not have proper error logging in them - unhandled errors are seen by the users in the form of error messages and stack traces. I know how to make...
3
by: Simon | last post by:
This problem has been driving me mad for months.... Seen a few posts on forums about it but no answers... No mention on MSDN etc. XP Pro SP1, VS.NET (c#) .Net framework 1.1, IIS 5.1. In a...
0
by: gilly3 | last post by:
I'm coming across all kinds of frustration implementing custom errors in ASP.NET 1.1. First, 401 - Authorization Failed My application uses Windows Integrated Authentication, and restricts...
2
by: George1776 | last post by:
All, I've recently upgraded our production ASP.NET/C# application from framework 1.1 to 2.0. Since then I've been plagued by out-of-memory errors and problems with the cache object (which may...
6
by: David Lozzi | last post by:
Hello there, I'm getting the following error System.NullReferenceException: Object reference not set to an instance of an object. at shopping_bag.GetBagTotals()
3
by: mpar612 | last post by:
I have code below (due to length I only included a portion). I am validating an email address. It checks to see if the email field is blank, in the proper format, etc... It prints errors to the...
25
by: JJ | last post by:
I only want to catch 404 errors at the application level (the rest are will be handled by the customerrors section of the web.config). How do I check for the error code in the Application_Error...
3
by: hardieca | last post by:
Hi, I've created an n-tier app where validation rules reside in the business layer. When a webform is saved, a business object examines its state, and if some property is invalid, throws a...
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?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.