Script debugger shows no script

J

John Dalberg

I am getting an error in IE with a line number. The line sumber is not
useful because it points to an html line in my html file.

The html file includes other html files.
So how do I use the script debugger to find the actual error? When I choose
script debugger->open, the script debugger opens with no source.
 
C

C A Upsdell

John said:
I am getting an error in IE with a line number. The line sumber is not
useful because it points to an html line in my html file.

The html file includes other html files.
So how do I use the script debugger to find the actual error? When I choose
script debugger->open, the script debugger opens with no source.

Use Mozilla or Firefox. They have a much better JS console.
 
C

C A Upsdell

John said:
The Error message shows in IE only.

Mozilla and Firefox don't display JS error messages. You have to switch
to their companion JS console, in Firefox by doing Tools, JS Console, in
order to see any errors. Usually there are a lot, because numerous
sites trigger JS errors, so clear the current list before refreshing the
page that causes the problem.
 
F

Frank Saunders, MS-MVP IE/OE

John Dalberg said:
I am getting an error in IE with a line number. The line sumber is not
useful because it points to an html line in my html file.

The html file includes other html files.
So how do I use the script debugger to find the actual error? When I
choose
script debugger->open, the script debugger opens with no source.

Go to Tools | Internet Options | Advanced.
Check the box to Disable script debugging.
Uncheck the box to Display a notification about every script error.

Disable the Script Debugger in IE (Line 142) - Win XP
http://www.kellys-korner-xp.com/xp_tweaks.htm

1. You might want to refresh your scripting engine:
http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp
Windows Script 5.6 for Windows 2000 and XP
http://www.microsoft.com/downloads/...43-7e4b-4622-86eb-95a22b832caa&DisplayLang=en

Sometimes there's a corrupt file in the cache and one must go to Tools |
Internet Options and click Delete Files.

2a. Start>Run>Regsvr32 vbscript.dll

2b. Start>Run>Regsvr32 jscript.dll

(WinXP users who have problems with 2a and 2b, see
http://www.mvps.org/inetexplorer/answers_9.htm)

3. Re-register all DLLs listed in http://support.microsoft.com/?kbid=281679

4. See also
Error Message When You Browse the Web: An Error Has Occurred in the Script
on This Page
http://support.microsoft.com/?kbid=306831
Scripting Errors When You View Web Pages in Internet Explorer after
Installing Office 2003
http://support.microsoft.com/?kbid=822521

5a. IE Tools>Internet Options>Advanced>Browsing>Enable third-party browser
extensions (uncheck & reboot).

5b. Find the hijacker that caused 5a to be checked (or if none were checked,
check for hijackware anyway):

Dealing with Hijackware
http://mvps.org/winhelp2002/unwanted.htm
http://aumha.org/a/parasite.htm
http://www.mvps.org/inetexplorer/Darnit.htm

How to Troubleshoot Script Errors in Internet Explorer
http://support.microsoft.com/kb/308260

--
Frank Saunders, MS-MVP, IE/OE
Please respond in Newsgroup only. Do not send email
http://www.fjsmjs.com
Protect your PC
http://www.microsoft.com./athome/security/protect/default.aspx
http://defendingyourmachine.blogspot.com/
 
J

John Dalberg

Mozilla and Firefox don't display JS error messages. You have to switch
to their companion JS console, in Firefox by doing Tools, JS Console, in
order to see any errors. Usually there are a lot, because numerous
sites trigger JS errors, so clear the current list before refreshing the
page that causes the problem.


I know about the JS console. I have 'ALL' chosen. It displays no errors
when I keep refreshing my page. IE shows a syntax error on some line. I
don't know what code is causing it because the line number is not related
to a line that has code while Firefox thinks everything is ok. That's what
is frustrating.
 
C

C A Upsdell

John said:
I know about the JS console. I have 'ALL' chosen. It displays no errors
when I keep refreshing my page. IE shows a syntax error on some line. I
don't know what code is causing it because the line number is not related
to a line that has code while Firefox thinks everything is ok. That's what
is frustrating.

URL?
 
C

C A Upsdell

John said:

Hmmm. The W3C HTML validator says that there are 12 HTML errors,
including an unbalanced </td>. As for CSS errors, the W3C CSS validator
needs valid HTML to check for CSS errors. I doubt that HTML or CSS
errors are at the root of you JS problem, but it wouldn't hurt to fix them.

The JS pretty well has to come from http://asiaoregon.com/menu/moz1.js,
since this has a line 9 (close enough to 8 for IE) which is extremely
long, tens of thousands of characters long.

I suggest that this line (which is basically a long document.write) be
broken up into smaller pieces so that you can find the piece that is
causing your problem. It might also help to break up the extremely
large var = var cswmDetectedBrowser line as well, as the problem could
be here, with the JS error message not being triggered till further down
in the code.
 
J

John Dalberg

Hmmm. The W3C HTML validator says that there are 12 HTML errors,
including an unbalanced </td>. As for CSS errors, the W3C CSS validator
needs valid HTML to check for CSS errors. I doubt that HTML or CSS
errors are at the root of you JS problem, but it wouldn't hurt to fix them.

The JS pretty well has to come from http://asiaoregon.com/menu/moz1.js,
since this has a line 9 (close enough to 8 for IE) which is extremely
long, tens of thousands of characters long.

I suggest that this line (which is basically a long document.write) be
broken up into smaller pieces so that you can find the piece that is
causing your problem. It might also help to break up the extremely
large var = var cswmDetectedBrowser line as well, as the problem could
be here, with the JS error message not being triggered till further down
in the code.


The syntax error wouldn't come from any html or css errors.
The js file used depends on what browsers is used. In my case I use IE 6 so
the file is IE6.js. I don't know why yours is moz1.js unless you were not
using IE.

The JS was produced by a commercial product called Webmenu from
Coalesys.com. The js is or should be correct. Their online demos do not
produce errors. Yes the JS is one long string but it shouldn't matter.

Do you know any utility that takes a long js and formats it? I won't to see
if it helps. Maybe IE can problems with long valid Javascript code.
 
C

C A Upsdell

John said:
The syntax error wouldn't come from any html or css errors.

Note very likely at all, but there is a tiny chance that the error
results from how the browser handles invalid code.
The js file used depends on what browsers is used. In my case I use IE 6 so
the file is IE6.js. I don't know why yours is moz1.js unless you were not
using IE.

Yeah, I used Firefox, since there is a Web Developer plugin for it that
made it a lot easier for me to look at your problem.

I looked at IE6.js, it has a similarly long line, so my advice about how
to pin down the error still holds.
The JS was produced by a commercial product called Webmenu from
Coalesys.com. The js is or should be correct. Their online demos do not
produce errors. Yes the JS is one long string but it shouldn't matter.

I don't think much of a product that generates completely different
scripts for different browsers. I find it much easier to make one
script that is smart.

In any case, the JS for IE is clearly not correct: if it were, it would
not generate a JS error message, would it?
Do you know any utility that takes a long js and formats it? I won't to see
if it helps. Maybe IE can problems with long valid Javascript code.

I don't know of such a utility, but it should be pretty easier to do
manually. Just break the long document.write into multiple, shorter
document.writes with a text editor that can handle long lines.
 
J

John Dalberg

Note very likely at all, but there is a tiny chance that the error
results from how the browser handles invalid code.


Yeah, I used Firefox, since there is a Web Developer plugin for it that
made it a lot easier for me to look at your problem.

I looked at IE6.js, it has a similarly long line, so my advice about how
to pin down the error still holds.


I don't think much of a product that generates completely different
scripts for different browsers. I find it much easier to make one
script that is smart.

Why not if different browsers behave differently using the same html, css &
js? I hope you know that IE does not conform to standards as good as a
browser like Firefox. IE is even buggy in many instances. Creating the same
js/css/html that works exactly the same way in all browsers is almost
impossible.

In any case, the JS for IE is clearly not correct: if it were, it would
not generate a JS error message, would it?

Maybe. I used the IE6 JS for Firefox and FF didn't report any errors. IE
seems to be picky about something. The fact I can't pinpoint the line is
another problem.

I don't know of such a utility, but it should be pretty easier to do
manually. Just break the long document.write into multiple, shorter
document.writes with a text editor that can handle long lines.

I understand. It's just too much manual work.
 
C

C A Upsdell

John said:
Why not if different browsers behave differently using the same html, css &
js? I hope you know that IE does not conform to standards as good as a
browser like Firefox. IE is even buggy in many instances. Creating the same
js/css/html that works exactly the same way in all browsers is almost
impossible.

Granted, different browsers sometimes require JS that is different in
some details. But I have always been able to create JS that uses object
detection or (less often) browser detection in a single script to deal
with the differences.

For example, to get an object by id, I use this subroutine:

function getObject ( id )
{
if ( id == "" )
return( null );
if ( document.getElementById && (obj = document.getElementById(id)) )
;
else if ( document.all && (obj = document.all[id]) )
;
else /* DOM not supported, or no object */
return( null );
return( obj );
}

which either returns the object, if it exists, or null, if it does not
exist. This subroutine uses object detection to deal with the browser
differences: e.g., better browsers would use document.getElementById,
but IE5 (which does not support getElementById) would use document.all.
In either case the code calling this subroutine does not care which
browser it is, except that it should check for null to avoid error
messages of the sort you have seen.
Maybe. I used the IE6 JS for Firefox and FF didn't report any errors. IE
seems to be picky about something. The fact I can't pinpoint the line is
another problem.

Well, you know the line causing the problem. It is just too long for you.
 
J

John Dalberg

John said:
Why not if different browsers behave differently using the same html, css &
js? I hope you know that IE does not conform to standards as good as a
browser like Firefox. IE is even buggy in many instances. Creating the same
js/css/html that works exactly the same way in all browsers is almost
impossible.

Granted, different browsers sometimes require JS that is different in
some details. But I have always been able to create JS that uses object
detection or (less often) browser detection in a single script to deal
with the differences.

For example, to get an object by id, I use this subroutine:

function getObject ( id )
{
if ( id == "" )
return( null );
if ( document.getElementById && (obj = document.getElementById(id)) )
;
else if ( document.all && (obj = document.all[id]) )
;
else /* DOM not supported, or no object */
return( null );
return( obj );
}

which either returns the object, if it exists, or null, if it does not
exist. This subroutine uses object detection to deal with the browser
differences: e.g., better browsers would use document.getElementById,
but IE5 (which does not support getElementById) would use document.all.
In either case the code calling this subroutine does not care which
browser it is, except that it should check for null to avoid error
messages of the sort you have seen.

The js file is Javascript that spits out html, css and js dynamically. It'
s not just a JS issue. You can have the same html and css and the page
would display a little differently in different browsers. Maybe the
elements are not aligned properly so you add or subtract a few pixels. In
this case you will you use different css attributes. The js files are quite
big so instead of having one huge js file for all browsers, it makes sense
to segregate them. It's also easier for debugging purposes.
so if IE5 doesn't support getElementById then you'll have an IE js file
that never uses getElementById instead of having all kinds of if statements
to continoulsy check whether some js function is supported or not.

Well, you know the line causing the problem. It is just too long for you.

Not quite so. If the line is in the js file, the file doesn't have 76 lines
so line 76 couldn't be in that file.
 
C

C A Upsdell

John said:
Not quite so. If the line is in the js file, the file doesn't have 76 lines
so line 76 couldn't be in that file.

When you first gave me the URL of the test page, the error was on a line
8, which closely matches the long line in the JS file. The reported
line number is now different, so you have clearly changed the test page.
 
R

Robert Aldwinckle

....


I'm getting an error at line 29. It it's for loader.js
I would suspect these two lines:

var csVendor = String(navigator.vendor);
var csProduct = String(navigator.product);

since IE6 doesn't have either of those properties defined
for that object in either Javascript or VBScript.
Those seem to be Netscape specific properties.

Shouldn't you make it getting and testing them conditionally
or recoverable or something?

Perhaps the source code for this page will help

http://www.howtocreate.co.uk/tutorials/jsexamples/sniffer.html

(Google web search for
navigator properties vendor product
)


BTW this newsgroup may not be the best one to post developer
issues such as this. Try one of the Scripting newsgroups
(e.g. listed under Web Development on the MSDN newsgroups menu)

http://msdn.microsoft.com/newsgroups/


Good luck

Robert Aldwinckle
---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top