Debugging IE

T

The Natural Philosopher

Solved it... Applied a class to all the span elements I wanted.
Selected all span tags, then iterated through them and only did what I
wanted to the ones where className matched the string I wanted...
Works on IE, FF and Safari. Phew! Thanks everybody for your help.

just don't have too many similar tags. IE7 is particularly slow scanning
a load of tags.
 
T

Timo Reitz

The said:
1/. names strictly apply only to form elements, not to random tags. FF
is kind to you. IE is not, in this respect.

I didn't know frame, iframe, img, a, object, map, param and meta are form
elements.
 
G

Gregor Kofler

(e-mail address removed) meinte:
Solved it... Applied a class to all the span elements I wanted.
Selected all span tags, then iterated through them and only did what I
wanted to the ones where className matched the string I wanted...
Works on IE, FF and Safari. Phew! Thanks everybody for your help.

Yes, a proper solution. FF (and other browsers) already have a native
getElementsByClassName() method.

Gregor
 
D

David Mark

just don't have too many similar tags. IE7 is particularly slow scanning
a load of tags.

Similar tags? And is this assertion based on code you wrote? If so,
it is inherently unreliable.
 
T

Thomas 'PointedEars' Lahn

I am writing a few scripts, primarily using firefox, with firebug
debugging is easy.

However when I try to run the script on IE7. I get the very unhelpful
error:

"Unknown runtime error": Line 38.

Line 38 doesn't even contain any javascript!!

MSHTML never got that right. Chances are the error is caused by the
statement that begins or ends in line 38 of one of the included script
files.
After inserting lots of alert statements, I've tracked the error down
to this line of code:

cbs.innerHTML='<img src="../images/checkfalse.png"
onclick="checkBoxClick(this);" id="checkbox'+i+'" ><br>';


Out of curiousity: Are `cbs' or `br' in line 38 of the script
resource?
This works without problems on firefox and safari.

So actually I have 2 questions:

1) Can you suggest any way to modify the above line to work on IE7?

Without context: no. To begin with, What is the value of `i'?

That said, avoid the proprietary `innerHTML' property in favor of DOM
Level 2+ methods:

// add feature tests and wrappers below
var o = cbs;
while (o.firstChild) o.removeChild(o.firstChild);
o.appendChild(
(function(img) {
if (!img) return null;

img.src = "../images/checkfalse.png";

// "DOM Level 0", use a wrapper method instead
img.onclick = function() {
checkBoxClick(this);
};

img.id = "checkbox" + i;

return img;
})(document.createElement("img")));
o.appendChild(document.createElement("br"));
2) Are there any good debuggers for IE (that give better errors, and
allow you to set breakpoints etc)?

Microsoft Script Debugger sufficed for most debugging tasks to date.
More, it is for free.


PointedEars
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,823
Latest member
Nadia88

Latest Threads

Top