473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

document.getElementsByTagName('html')[0].style; produces an error

Warning 2 Error updating JScript IntelliSense: ..snip.. ColorScrollbar.js:
'document.getElementsByTagName(...).0.style' is null or not an object

I believe the following is what it is complaining about:

var htmlStyle = document.getElementsByTagName('html')[0].style;

I tried 'body' instead of "html" and got the same error in my error list
pane.

Do you understand what is wrong?
Thanks
Oct 23 '08 #1
2 6276
I've never used document.getElementsByTagName, but something that the W3C
DOM specifies that you can use to reference the <bodytag is document.body.
This may not help in referencing the <htmltag, but it sounds like you can
survive with either one. Something else you could do is add an id attribute
to the <bodyor <htmltag and use document.getElementById, which is
usually more reliable. You may also want to try writing some test code to
see exactly what is returned by document.getElementsByTagName('html') to
help you determine where the problem is. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"AAaron123" <aa*******@roadrunner.comwrote in message
news:uE**************@TK2MSFTNGP03.phx.gbl...
Warning 2 Error updating JScript IntelliSense: ..snip.. ColorScrollbar.js:
'document.getElementsByTagName(...).0.style' is null or not an object

I believe the following is what it is complaining about:

var htmlStyle = document.getElementsByTagName('html')[0].style;

I tried 'body' instead of "html" and got the same error in my error list
pane.

Do you understand what is wrong?
Thanks

Oct 24 '08 #2


"AAaron123" <aa*******@roadrunner.comwrote in message
news:uE**************@TK2MSFTNGP03.phx.gbl...
Warning 2 Error updating JScript IntelliSense: ..snip.. ColorScrollbar.js:
'document.getElementsByTagName(...).0.style' is null or not an object

I believe the following is what it is complaining about:

var htmlStyle = document.getElementsByTagName('html')[0].style;

I tried 'body' instead of "html" and got the same error in my error list
pane.

Do you understand what is wrong?
Thanks
Try getting the collection and making sure it is one. Some of the IE methods
incorrectly return single instances rather than collections when there is
only one.
var h = document.getElementsByTagName('html');
alert(h.length);
alert(h.innerHTML.substr(0, 100));

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

Oct 24 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: newbie | last post by:
Hi, Is it possible to use rpc style for input AND at the same time use document style for output? Thanks in advsnce
0
by: lavu | last post by:
I have a COM dll, that I am using through an interop for my webservice in .NET. Essentially I have wrapper web methods in my webservice that I call for the dll functions. All the methods seem to...
2
by: Alan T | last post by:
In my C# application, I want to open a Word document using the code from the Help: using Microsoft.Office.Interop.Word; object readOnly = true; object fileName = @"C:\Test\NewDocument.doc"; ...
3
by: Jens Jensen | last post by:
Does Microsoft now support Document style web service as part of .NET 3.0 (Windows communication foundations)?
0
by: Gops | last post by:
In a word document i've a paragraph. Programmatically i wants to check the spell and left of each line of the paragraph i've to give the Error description. In this above task, I've done the spell...
8
by: johnsonlau | last post by:
When I use document.write to replace the comment of a frame, I found that the page was always showing as loading in Firefox (2.0.0.2). But it seems that it is OK in IE6. Could someone help me...
3
by: mfc1981 | last post by:
Hi. I need to access to the hover style of an element with javascript. How can i do this? Best regards Manuel
5
by: Yansky | last post by:
Hi, I'm trying to write a backslash as a text node into the style tag of a web page, but IE is not letting me(perhaps because of security or something?). I need to write a backslash because it is...
6
by: Prisoner at War | last post by:
Okay, no such thing, apparently, in the DOM.... How am I supposed to tell JavaScript "turn the whole page opaque"? Is there a "JavaScript/CSS dictionary" and a "JavaScript/CSS grammar" about??...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.