[Javascript] dom/javascript question regarding Internet Explorer

Lee Bettridge lbettridge at twowaytv.co.uk
Fri Jul 20 08:54:40 CDT 2007


Yep, that would have been useful info wouldn't it :-) my mistake.

 

It fails on this line

 

var str_title = title.firstChild.data;  (error = Object Required)

 

-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu] On Behalf Of Peter Brunone
Sent: 20 July 2007 14:40
To: javascript at LaTech.edu
Subject: re: [Javascript] dom/javascript question regarding Internet
Explorer

 

Hi Lee,

    In cases like this, I always ask "what part doesn't work?" since the
point of failure will usually help you (or us) to isolate the difference
between the browsers.  Can you get a bit more data on which line it is
at which things go wrong?  An error message would be one way to identify
this point; another would be a debugger (you can download the IE Script
Debugger from MS though it doesn't always help), and a third would be
the old-fashioned brute-force method of using alert, window.status, or
document.write to show what data you have so far.

Cheers,

Peter

________________________________

From: "Lee Bettridge" <lbettridge at twowaytv.co.uk>
Sent: Friday, July 20, 2007 2:59 AM
To: "[JavaScript List]" <javascript at LaTech.edu>
Subject: [Javascript] dom/javascript question regarding Internet
Explorer


I want to copy the contents of the tag in an html
document and write this elsewhere in the doc when it loads.
The following works in Firefox but not in ie, could anyone point out why
and maybe suggest an alternative please.


HTML

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">















JAVASCRIPT

var title = document.getElementsByTagName("TITLE").item(0);
var str_title = title.firstChild.data;

var obj = document.getElementById("document_header");
while(obj.hasChildNodes()) obj.removeChild(obj.childNodes[0]);
obj.appendChild(document.createTextNode(str_title));
________________________________________________________
Two Way TV is the trading name of Two Way Media Ltd
Company Number: 4904168
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript


________________________________________________________
Two Way TV is the trading name of Two Way Media Ltd
Company Number: 4904168

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20070720/d08b21f6/attachment.htm>


More information about the Javascript mailing list