Shawn Dow

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromShawn Dow
ToMe
SubjectStatus Bar error on page caused by Javascript
Date30 December 2005 05:52
Hi:

I am having a little problem with the Javascripts I
use on my site. I do hope you can help.

Here is the link to my site. 

[URL]

All of my pages are the same, except for the sitemap
which does not import the drop down links.

I am using the present javascripts:

[Ed. DO NOT use this script. Conditional compilation is nonstandard
garbage. This should not be used.]

[URL]/xmlhttp.js

function include(xUrl,xId) {

  var xmlhttp = false;

  /*@cc_on @*/

  /*@if (@_jscript_version >= 5)

  // JScript gives us Conditional compilation, we can
  // cope with old IE versions.
  // and security blocked creation of the objects.

  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
   } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
   }

  /*@end @*/

  if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
    xmlhttp = new XMLHttpRequest();
  }

  xmlhttp.open("GET", xUrl,true);
  xmlhttp.onreadystatechange=function() {

          if (xmlhttp.readyState==4) {
                document.getElementById(xId).innerHTML = xmlhttp.responseText;
          }
  }
  xmlhttp.send(null)

}

....and.....

[URL]/drop_down.js

// JavaScript Document

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;

.....and a small bit written in my pages like so.....

<script type="text/javascript">
<!-- hide from none JavaScript Browsers 

Image1= new Image(1,70)
Image1.src = "gradient.jpg"

Image2= new Image(50,50)
Image2.src = "light.jpg"

Image3= new Image(150,60)
Image3.src = "leg.jpg"

Image4= new Image(120,70)
Image4.src = "mini[name].jpg"

Image5= new Image(550,70)
Image5.src = "[name].gif"
// End Hiding -->
</script>

When I am on a given page on the site and I click a
link that takes me out of the site and then I hit the
"back" button to return, my drop down menu won't work
(they are on the right side of the page), until I hit
the refresh button. You can also see the "Error On
Page" message in the status bar at this point. The
sitemap page contains ordinary links not imported with
Java.

I am using the "xmlhttp.js" to import some html into
my page, since my server does not provide Server Side
Includes. The "drop_down.js" is for the drop-down
links that the previous javascript imports.

Also, can I put the script for preloading images into
an alternate .js file, or does it need to be in the
actual HTML page? I use XHTML throughout the site and
all of my pages have been validated at W3.org, as well
as the CSS files.

Your help would be appreciated.
thanks,
Shawn Dow

P.S. I will post a link to your site if you like. Let
me know.
FromMe
ToShawn Dow
SubjectRe: Status Bar error on page caused by Javascript
Date30 December 2005 10:13
Shawn,

> When I am on a given page on the site and I click a
> link that takes me out of the site and then I hit the
> "back" button to return, my drop down menu won't work
> (they are on the right side of the page), until I hit
> the refresh button. You can also see the "Error On
> Page" message in the status bar at this point.

From your wording, I am guessing that you are seeing this error in Internet
Explorer, since the other browsers do not use the status bar for JavaScript
error messages.

But here's the thing; I went to your site with IE 6 (windows XP SP 2), Opera
8 and 9, and Firefox 1.5. It worked perfectly in all of them. No error
messages, no menu failures. So I guess this needs some more investigation.

What I tried:
1. open the front page
2. click "enter"
3. select "Shows #1 - #20"
4. select "A&E DVD Review, Set 1 > Ep's 1 - 4"
5. click the link to your [brand] at the bottom
6. go back
The menu still worked.

So we must be doing something different to each other. Can you tell me;
1. exactly what browser(s) and version(s) you are getting this error message
in.
2. exactly what links you click, etc, to reproduce the bug.
3. if your browser has a customised installation, any added toolbars (ones
that do popup blocking, etc).
4. if you have any proxy server that rewrites parts of the page.
5. if your Internet service provider uses any kind of proxy that messes with
your caching.

> Also, can I put the script for preloading images into
> an alternate .js file, or does it need to be in the
> actual HTML page?

Sure, just put it in a .js file, and then link to it the same way as you do
with other JavaScript files:
<script src="preload.js" type="text/javascript"></script>

> P.S. I will post a link to your site if you like. Let
> me know.

There is no obligation, but you are free to do this if you want to, and you
think it will be beneficial to your users :)


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromShawn Dow
ToMe
SubjectRe: Status Bar error on page caused by Javascript
Date30 December 2005 15:35
Hi:

Thanks for the quick reply. The version of IE I am
using is Version 6.0.2800.1106. I click the following
links:

1. Index page, click ENTER
2. Links
3. Angels Index (under Galleries & Tributes)
3. Click the [brand] link at the bottom of the page.
5. I click back.
The menu is there, but when I place my cursor on it,
the links will still not "drop-down". I refresh the
page and they work again.

I do not believe my wife has any special installations
in the toolbar. We do have a CD Wizard, a couple of
virus programs, a firewall, [brand], [brand].

I have connected to the internet with the other
browsers I have tested the site with. They are:

1. Fire Fox Version: 1.0.4
2. Netscape Navigator Version: 8.0.2 Based on Firefox
3. Opera Version: 8.01

The problem doesn't seem to be happening in the above
three. It seems to be a problem with Internet
Explorer. I should also mention that the Javascript
"xmlhttp.js" has some info within the page in order to
"call" the menu into it. Again, this is like Server
Side Includes. Just a "client side includes" for ease
of updates.

When I click on the [brand] link and then go back to
angels.html, I still see the "Error On Page", but I am
also noticing something else. When I place my cursor
on the menu, the first two links actually work. "Home"
and "Sitemap". The status bar says: "Shortcut to
index.html" and "Shortcut to sitemap.html" and when I
place my cursor on "links", the status bar says
"Shortcut to links.html". All fine. Below that, when I
place the cursor on every link I get: "Shortcut to
link.html#" except for "[brand]", "[brand]",
"Guestbook" and "Contact".

I decided that since the "Ultimate DVD" link seems to
be okay, I would click that one. It did indeed take me
to the proper page. When I got there, I clicked on the
[brand] link at the bottom and when I came back, again
the links would not work. However, this time, when I
placed my cursor on the drop-down links, I would get
the message "Shortcut to ultimatedvd.html#". This is
the same in all of the browsers and the only one that
has a real problem is IE. The links will not pop-out.

<script type="text/javascript">
include('navigation.html',"menu");
</script>

This calls the "xmlhttp.js" which imports the menu
from an alternate page:

"navigation.html."

I am still confused as to where the problem is
exactly. Since it seems that the links that refuse to
work are all the ones that pop out, then the problem
could be between "drop_down.js" and IE? I went online
with the other three browsers (FF, NN and Opera) and
there was no problems at all. Everything worked. I do
not have any pop-up blocking in IE. I am not using a
proxy server. I am not aware as to whether the server
uses any kind of proxy. But, since the other three
browsers had no problems online, I think that could be
ruled out.

It may be some setting I have in Internet Explorer? It
is possible I suppose. This is an area where my wife
knows more than I do. I will ask her about it. At any
rate, I hope the info I have provided here will give
you a clearer picture. Thanks for the help.

Shawn Dow
FromMe
ToShawn Dow
SubjectRe: Status Bar error on page caused by Javascript
Date30 December 2005 15:54
> Thanks for the quick reply. The version of IE I am
> using is Version 6.0.2800.1106. I click the following
> links:

[snip]

ok, the steps to reproduce were good, but I am just not seeing the problem.
It works perfectly well for me. I am at a loss to understand what is going
wrong, because I see nothing obvious in the code being used.

This has to be related to your installation.

Are you using offline mode? (usually shown in the 'file' menu)

Have you changed your cache settings? (tools - internet options - temporary
internet files settings - check for newer versions automatically)

What version of windows are you using (since the latest IE updates are only
available on Windows XP SP 2)?

> I am not aware as to whether the server
> uses any kind of proxy. But, since the other three
> browsers had no problems online, I think that could be
> ruled out.

Not necessarily. Opera's cache handling is very different to IE's, and some
transparent caching proxies behave differently with different browsers. But
for now, let's assume that this is not the cause of your problem.
FromShawn Dow
ToMe
SubjectRe: Status Bar error on page caused by Javascript
Date30 December 2005 16:04
Hi:

I took a look at the settings for my browser. Under
"Internet Options" I clicked "Advanced". Then I saw an
option called "Display a Notification About Every
Script Error". I clicked that, went to site online,
clicked the appropriate links and got this message:

"Problems with this webpage might prevent it from
being dispayed properly or functioning properly. In
the future, you can display this message by
double-clicking the warning icon displayed in the
status bar."

I have decided to leave the "Always display this
message when a page contains errors" checked for
obvious reasons.

Here are the details:
Line: 7
Char: 11
Error: Object required
Code: 0
URL: http....

I should point out that this is the exact same error
message for every page I try. The problem is obviously
repeated again and again. The message states "Object
Required" but what object is I do not know.

I have a lot of other info below that you may or may
not have looked at. Thanks to your questions I was
able to track this down. I hope you may know what the
"object" is. Here are the first lines of my webpage.
Is this the place the error message is referring to?


<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
<title>Who's Who Of The [name] Show - Page
1</title>

<meta name="description" content="Who's Who Of The
[name] Show, The [name] Show" />
<meta name="keywords" content="Who's Who Of The [name]
Show" />
<meta name="author" content="threerandot" />

<link rel="stylesheet" type="text/css"
href="print.css" media="print" />
<link rel="stylesheet" type="text/css"
href="angels01.css" media="screen" />
<script src="xmlhttp.js"
type="text/javascript"></script>
<script src="drop_down.js"
type="text/javascript"></script>
<style type="text/css"></style>

<script type="text/javascript">
<!-- hide from none JavaScript Browsers 

Image1= new Image(1,70)
Image1.src = "gradient.jpg"

Image2= new Image(50,50)
Image2.src = "light.jpg"

Image3= new Image(150,60)
Image3.src = "leg.jpg"

Image4= new Image(120,70)
Image4.src = "mini[brand].jpg"

Image5= new Image(550,70)
Image5.src = "[brand].gif"
// End Hiding -->
</script>
</head>
<body>


Thanks, 
Shawn Dow
FromMe
ToShawn Dow
SubjectRe: Status Bar error on page caused by Javascript
Date30 December 2005 16:33
Shawn,

> Here are the details:
> Line: 7
> Char: 11
> Error: Object required
> Code: 0
> URL: http....

Unfortunately, IE's errors are the worst of any browser (I even prefer
Safari's silence). The line number never makes any sense, since it does not
understand external files. As for the message "Object required" message,
that is fairly typical of IE. It means "I could not reference something I
thought I could reference" without giving any clue at all of what the actual
error is.

It is unfortunately no help at all. Ok, so we need some more careful
debugging to work out where it goes wrong. The simple way that people
usually do this is to stick alerts in the script, and work out which one
does not appear. This can mean thousands or alerts, so confirms are better
(as I will show you).

Assume this is your script:

function doSomething() {
  line1();
  var line2 = this;
}

what you do is this:

var showAlert = true;
function safealert(oMsg) {
  if(!showAlert) { return; }
  showAlert = confirm(oMsg);
}

function doSomething() {
  safealert(1);
  line1();
  safealert(2);
  var line2 = this;
  safealert(3);
}

Then you wait to see which alert fails to show up. If alerts 1 and 2 turn
up, but not 3, then you can assume that the error occurred in the line
between 2 and 3.

I'm afraid this is going to take some work on your part.
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.