• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1257
  • Last Modified:

Javascript "Error: Object required"

With IE7 if you go here http://alturl.com/287f
then enter for example the values 11, 11 and 11 as "dimensioni"
this Javasscript error appears:
Line: 15
Char: 3
Error: Object required
Code: 0

If I open the source of the page I don't see anything that matters in line 15.

How can I know what file and line it's referring to?  what debugging tool should I use?

Note: in Firefox with Firebug I don't see any Javascript error.   I see it only in IE7
0
lucavilla
Asked:
lucavilla
  • 5
  • 3
  • 2
  • +1
3 Solutions
 
BadotzCommented:
Chances are the error is on line 14 or sixteen - the notifier is notoriously errant ;-)
0
 
lucavillaAuthor Commented:
here are the lines from 8 to 17:

<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
-->
</style>

Still convinced that the Javascript error can be from line 14 to line 16?    :)

I suspect that the error is in some third file (...js) called by this page but how can I find what is it?
0
 
abelCommented:
Badotz is right in that you should ignore the Line/char, esp. if you have external javascripts, nobody knows how to go from those data to the real position. However, running your page through Visual Studio gives that:

  • on line 814 of script-get.js, the function OnResize is called (don't know why) with the method clip.reposition("d_clip_button")
  • then, on line 172 of ZeroClipboard.js there's a function "reposition" which calls ZeroClpboard.$(elem), with the value "d_clip_button" (still).
  • then, on line 14 (yes, that's quite close to the said line 15) inside the function $, the method thingy.addClass is called, but thingy is null (on the line before that, getElementById(thingy) did not succeed, because the element "d_clip_button" apparently does not exist.
That's what I got. What it does, I don't know, but that's the source of your error.

-- Abel --


0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
BadotzCommented:
Put

debugger;

on its own line in the .JS file and step through your code.
0
 
BadotzCommented:
Or look in each external .JS file for lines 14-16 and see if you can figure it out from there, smarty=pants ;-)
0
 
abelCommented:
> Or look in each external .JS file for lines 14-16

check above: it si in the script-get.js, line 15, trying to do a getElementById with a non-existing element id and then referencing that element ;-)
0
 
bui_trung_hieuCommented:
I found that your error comes from line 14 of ZeroClipboard.js

     if (!thingy.addClass) {

This error is raised because thingy is null, so you cannot check whether thingy.addClass exists. When using firebug, I found that you call that function with 'd_clip_button' as thingy.

Solution: check thingy's existence first

if (!!thingy && !thingy.addClass) {
0
 
abelCommented:
@bui_trung_hieu, no offense meant, but 4 comments ago, I said exactly that: #24181052  :)
0
 
bui_trung_hieuCommented:
@abel : sorry, I didn't see your answer when posting mine.
0
 
abelCommented:
np, I see now that the time wasn't that far apart and I have it all the time myself as well ;)
0
 
lucavillaAuthor Commented:
thanks abel
and thanks bui_trung_hieu for the fast "solution", that worked :-D
0
 
abelCommented:
> thanks abel and thanks bui_trung_hieu for the fast "solution", that worked :-D

glad we could be of some help :)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now