9 replies [Last post]
JAGNikJen
JAGNikJen's picture
Offline
Regular
Fort Worth, TExas
Last seen: 14 years 25 weeks ago
Fort Worth, TExas
Joined: 2006-10-20
Posts: 33
Points: 0

I know nothing of JS, except to copy and paste as instructed by articles - I have a web page I'm working on, but I'm getting a "Done, but with errors on the page." error message in IE6 & 7, but not the latest version of FF.

I've validated the html and all three CSSs, so I thought looking at the javascript would be the next logical thing to do. However, when I Google javascript validation I get articles on how to use JS to validate forms...

The temp URL is www.propg.com/tccdla

Can anyone point me in the right direction?

Thanks a bunch.

Jen

:shrug:

Tags:
Katie
Katie's picture
Offline
Enthusiast
Seattle, WA
Last seen: 6 years 29 weeks ago
Seattle, WA
Timezone: GMT-8
Joined: 2006-08-06
Posts: 357
Points: 2

The most useful tool I've

The most useful tool I've found when troubleshooting JavaScript is the Firebug add-on ( https://addons.mozilla.org/firefox/1843/ ) for Firefox. Here are the two errors that it reports from your page:

this.divObj has no properties
this.divObj.style.overflow="hidden"
animatedcollapse.js (line 9)

qm_create is not defined
qm_create(0,true,250,250,false,false,false,false)...
tccdla (line 97)

So, the first line in each error is what's wrong. The second line shows the command that caused the error, and the third line shows the file name and line number on which the error occurs.

Hope that helps!

Blog: Pew Pew Laser Blog
Online File Storage: DropBox
Daily Deals on Local Activities: Groupon

JAGNikJen
JAGNikJen's picture
Offline
Regular
Fort Worth, TExas
Last seen: 14 years 25 weeks ago
Fort Worth, TExas
Joined: 2006-10-20
Posts: 33
Points: 0

Thanks a bunch, Katie...

Now if I just understood what that meant and how to fix it...

Jen

Katie
Katie's picture
Offline
Enthusiast
Seattle, WA
Last seen: 6 years 29 weeks ago
Seattle, WA
Timezone: GMT-8
Joined: 2006-08-06
Posts: 357
Points: 2

Yeah, it's much trickier to

Yeah, it's much trickier to troubleshoot a failing JavaScript - especially if you haven't coded it up yourself. But I see you're down to 1 error now. Smile

To hazard a guess, I suspect that the this.divObj error may be occurring because divObj doesn't exist anymore? Maybe it was a div that used to exist, but now doesn't.

Blog: Pew Pew Laser Blog
Online File Storage: DropBox
Daily Deals on Local Activities: Groupon

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 1 year 12 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

Another reason for objects

Another reason for objects to not be defined is that the script is run before the html has built that object. Scripts run as they're read.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

JAGNikJen
JAGNikJen's picture
Offline
Regular
Fort Worth, TExas
Last seen: 14 years 25 weeks ago
Fort Worth, TExas
Joined: 2006-10-20
Posts: 33
Points: 0

Well then...

Is there any way to resolve that?

I don't want a page that says done but with errors on it...

Not for a lawyers organization...

Thanks,

Jen

Triumph (not verified)
Anonymous's picture
Guru

JAGNikJen wrote:Is there any

JAGNikJen wrote:
Is there any way to resolve that?

I don't want a page that says done but with errors on it...

Not for a lawyers organization...

Thanks,

Jen
LOL. There's a joke in there somewhere. Wink

Why not make it a function and call it at the bottom of the page? Goodness, I haven't done javascript in so long. IIRC, there is a way to delay execution of a script and there's a way to trigger it after the page loads (I think onload) but that's not exactly unobtrusive.

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 9 years 35 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

Have your script attach

Have your script attach itself to the window's onload event.

addEvent(window, 'load', myFunctionName, false);

/*
* Crossbrowser addEvent & RemoveEvent functions
* Courtesy of http://www.soziologie.uni-halle.de/unger/scripts/workshop_internet/fr_js_322.html
*/
function addEvent(obj, eventType, afunction, isCapture) {
// W3C DOM
if (obj.addEventListener) {
obj.addEventListener(eventType, afunction, isCapture);
return true;
}
// Internet Explorer
else if (obj.attachEvent) {
return obj.attachEvent("on"+eventType, afunction);
}
else return false;
}

The above code can be placed in a javascript file. If the error is not due to problems in the loading/execution sequence but due to a poorly written script you can get around the error message by wrapping the function (or a call to the function) inside a try/catch/finally block, e.g.

try { /* some code ... e.g. my function */ } catch(err) { /* stuff to do if an error occurs, can do nothing */ } finally { /* optional: stuff to do to finish, irrregardless of success or error, can do nothing */ } }

JAGNikJen
JAGNikJen's picture
Offline
Regular
Fort Worth, TExas
Last seen: 14 years 25 weeks ago
Fort Worth, TExas
Joined: 2006-10-20
Posts: 33
Points: 0

Thanks so much, everyone...

who offered suggestions and helpful tips.

:thumbsup:

I finally got all the issues resolved by taking everything one step at a time, reading each error, and trying to figure out what it was telling me.

Thanks, Katie, for the Firebug tool. That was especially helpful in pinpointing the troublesome lines. (Oh, and I see you changed your icon - I kinda liked Lego Leia...)

Jen

Katie
Katie's picture
Offline
Enthusiast
Seattle, WA
Last seen: 6 years 29 weeks ago
Seattle, WA
Timezone: GMT-8
Joined: 2006-08-06
Posts: 357
Points: 2

Lego Leia IS cool.

Lego Leia IS cool. But Talk Like a Pirate day is coming. (It's here, I suppose, depending on where you are in the world) So I figured I'd play around. And, if anybody needs some sweet pirate icons, check out the link in my sig. Wink

Blog: Pew Pew Laser Blog
Online File Storage: DropBox
Daily Deals on Local Activities: Groupon