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:
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!
Thanks a bunch, Katie...
Now if I just understood what that meant and how to fix it...
Jen
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.
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.
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
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
JAGNikJen wrote:Is there any
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.
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.
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 */
}
}
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
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.