Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > A question please

Reply
Thread Tools

A question please

 
 
Peter
Guest
Posts: n/a
 
      12-10-2006
I'm new at this stuff -- so this is probably an incredibly dopey, newby
question. Please bear with me. I don't know if it's a HTML or javascript
question. (Or, if a different area altogether, please steer me to the right
group.)

I can view the members of the "window" object with the following javascript.
It returns all the methods, properties, events, etc.

<script type="text/javascript">
for(i in window)
{
window.document.write(i + "<br />");
}
</script>


I can do the same thing for the "document" object by changing the expression
to read...

<script type="text/javascript">
for(i in window.document)
{
window.document.write(i + "<br />");
}
</script>


And then I can check out an individual property, (example "protocol"), with
the following. It returns "HyperText Transfer Protocol".

<script type="text/javascript">
window.document.write(window.document.protocol);
</script>


So far, so good....

But -- I can't find a way to address the "html" or the "head" objects. I
know they're HTML elements, (<html>, <head>), but they also exist as objects
because I see on reference sites that they have methods, properties, events,
etc. So they've got to be child objects of some other object higher in the
hierarchy. Right? And there has to be some way to address them. Right?

For instance -- on the MSDN site, the docs say that the "innerText" property
of the "html" object, "Sets or retrieves the text between the start and end
tags of the object." OK -- using javascript, how do I "set" or "retrieve"
that property?

"window.html.innerText" doesn't work. Neither does
"window.document.hml.innerText". Is there an object higher than the window
object that "html" object is a child of?

Any help greatly appreciated. I've been staring at this *^#(%^ monitor for
about 8 hours now and my eyeballs are aching.


 
Reply With Quote
 
 
 
 
Peter Michaux
Guest
Posts: n/a
 
      12-10-2006
Peter wrote:

> But -- I can't find a way to address the "html" or the "head" objects. I
> know they're HTML elements, (<html>, <head>), but they also exist as objects
> because I see on reference sites that they have methods, properties, events,
> etc. So they've got to be child objects of some other object higher in the
> hierarchy. Right? And there has to be some way to address them. Right?



This works for me in Opera 9

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
</head>
<body>
<script type="text/javascript">
var html = document.getElementsByTagName('html')[0];
for (var p in html) {
document.write(p+'<br>');
}
</script>
</body>
</html>



> For instance -- on the MSDN site, the docs say that the "innerText" property
> of the "html" object, "Sets or retrieves the text between the start and end
> tags of the object." OK -- using javascript, how do I "set" or "retrieve"
> that property?


This works for me in Opera 9 to see the innerHTML. I don't know when
setting the innerHTML of the html element would be a good idea.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<script type="text/javascript">
window.onload=function() {
alert(document.getElementsByTagName('html')[0].innerHTML);
};
</script>
</head>
<body>
</body>
</html>


- Peter

 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      12-10-2006
Peter wrote:
> I'm new at this stuff -- so this is probably an incredibly dopey, newby
> question. Please bear with me. I don't know if it's a HTML or javascript
> question. (Or, if a different area altogether, please steer me to the right
> group.)
>
> I can view the members of the "window" object with the following javascript.
> It returns all the methods, properties, events, etc.
>
> <script type="text/javascript">
> for(i in window)
> {
> window.document.write(i + "<br />");
> }
> </script>
>
>
> I can do the same thing for the "document" object by changing the expression
> to read...
>
> <script type="text/javascript">
> for(i in window.document)
> {
> window.document.write(i + "<br />");
> }
> </script>
>
>
> And then I can check out an individual property, (example "protocol"), with
> the following. It returns "HyperText Transfer Protocol".
>
> <script type="text/javascript">
> window.document.write(window.document.protocol);
> </script>
>
>
> So far, so good....
>
> But -- I can't find a way to address the "html" or the "head" objects. I
> know they're HTML elements, (<html>, <head>), but they also exist as objects
> because I see on reference sites that they have methods, properties, events,
> etc. So they've got to be child objects of some other object higher in the
> hierarchy. Right? And there has to be some way to address them. Right?
>
> For instance -- on the MSDN site, the docs say that the "innerText" property
> of the "html" object, "Sets or retrieves the text between the start and end
> tags of the object." OK -- using javascript, how do I "set" or "retrieve"
> that property?
>
> "window.html.innerText" doesn't work. Neither does
> "window.document.hml.innerText". Is there an object higher than the window
> object that "html" object is a child of?
>
> Any help greatly appreciated. I've been staring at this *^#(%^ monitor for
> about 8 hours now and my eyeballs are aching.
>
>

1 Download a copy of Firefox.

2 Install with the "Custom Install" option to mark sure DOM Inspector is
checked

3 Or better yet, install the Web Developers Bar extension
https://addons.mozilla.org/firefox/60/

4 Open a web page and use the DOM Inspector to traverse the document
tree and view all the attributes.

An indispensable "learning|debugging" tool


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Peter Michaux
Guest
Posts: n/a
 
      12-10-2006

Jonathan N. Little wrote:
> Peter wrote:


> > But -- I can't find a way to address the "html" or the "head" objects. I
> > know they're HTML elements, (<html>, <head>), but they also exist as objects
> > because I see on reference sites that they have methods, properties, events,
> > etc. So they've got to be child objects of some other object higher in the
> > hierarchy. Right? And there has to be some way to address them. Right?

>
> 1 Download a copy of Firefox.
>
> 2 Install with the "Custom Install" option to mark sure DOM Inspector is
> checked
>
> 3 Or better yet, install the Web Developers Bar extension
> https://addons.mozilla.org/firefox/60/
>
> 4 Open a web page and use the DOM Inspector to traverse the document
> tree and view all the attributes.


Or maybe even better than the DOM inspector is the
http://getfirebug.com plugin.

Peter

 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      12-10-2006
Peter Michaux wrote:

> Or maybe even better than the DOM inspector is the
> http://getfirebug.com plugin.


Hmmm, looks interesting. Ain't innovation great! Support "Open Source".

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Peter
Guest
Posts: n/a
 
      12-10-2006
"Peter Michaux" <> wrote in message
news: oups.com...
> Peter wrote:
>
>> But -- I can't find a way to address the "html" or the "head" objects. I
>> know they're HTML elements, (<html>, <head>), but they also exist as
>> objects
>> because I see on reference sites that they have methods, properties,
>> events,
>> etc. So they've got to be child objects of some other object higher in
>> the
>> hierarchy. Right? And there has to be some way to address them. Right?

>
>
> This works for me in Opera 9
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
> <html lang="en">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> <title>untitled</title>
> </head>
> <body>
> <script type="text/javascript">
> var html = document.getElementsByTagName('html')[0];
> for (var p in html) {
> document.write(p+'<br>');
> }
> </script>
> </body>
> </html>
>
>
>
>> For instance -- on the MSDN site, the docs say that the "innerText"
>> property
>> of the "html" object, "Sets or retrieves the text between the start and
>> end
>> tags of the object." OK -- using javascript, how do I "set" or "retrieve"
>> that property?

>
> This works for me in Opera 9 to see the innerHTML. I don't know when
> setting the innerHTML of the html element would be a good idea.
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
> <html lang="en">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> <title>untitled</title>
> <script type="text/javascript">
> window.onload=function() {
> alert(document.getElementsByTagName('html')[0].innerHTML);
> };
> </script>
> </head>
> <body>
> </body>
> </html>
>
>
> - Peter



Thanks. That works. Now I can get in and look around.

>> I don't know when setting the innerHTML of the
>> html element would be a good idea.


LOL. I guess I picked an extreme example. You're right -- I doubt I'd ever
have a reason to change that specific property.


 
Reply With Quote
 
Peter
Guest
Posts: n/a
 
      12-10-2006

"Jonathan N. Little" <> wrote in message
news:3394$457c3107$40cba7a4$...
> Peter wrote:
>> I'm new at this stuff -- so this is probably an incredibly dopey, newby
>> question. Please bear with me. I don't know if it's a HTML or javascript
>> question. (Or, if a different area altogether, please steer me to the
>> right group.)
>>
>> I can view the members of the "window" object with the following
>> javascript. It returns all the methods, properties, events, etc.
>>
>> <script type="text/javascript">
>> for(i in window)
>> {
>> window.document.write(i + "<br />");
>> }
>> </script>
>>
>>
>> I can do the same thing for the "document" object by changing the
>> expression to read...
>>
>> <script type="text/javascript">
>> for(i in window.document)
>> {
>> window.document.write(i + "<br />");
>> }
>> </script>
>>
>>
>> And then I can check out an individual property, (example "protocol"),
>> with the following. It returns "HyperText Transfer Protocol".
>>
>> <script type="text/javascript">
>> window.document.write(window.document.protocol);
>> </script>
>>
>>
>> So far, so good....
>>
>> But -- I can't find a way to address the "html" or the "head" objects. I
>> know they're HTML elements, (<html>, <head>), but they also exist as
>> objects because I see on reference sites that they have methods,
>> properties, events, etc. So they've got to be child objects of some other
>> object higher in the hierarchy. Right? And there has to be some way to
>> address them. Right?
>>
>> For instance -- on the MSDN site, the docs say that the "innerText"
>> property of the "html" object, "Sets or retrieves the text between the
>> start and end tags of the object." OK -- using javascript, how do I "set"
>> or "retrieve" that property?
>>
>> "window.html.innerText" doesn't work. Neither does
>> "window.document.hml.innerText". Is there an object higher than the
>> window object that "html" object is a child of?
>>
>> Any help greatly appreciated. I've been staring at this *^#(%^ monitor
>> for about 8 hours now and my eyeballs are aching.
>>
>>

> 1 Download a copy of Firefox.
>
> 2 Install with the "Custom Install" option to mark sure DOM Inspector is
> checked
>
> 3 Or better yet, install the Web Developers Bar extension
> https://addons.mozilla.org/firefox/60/
>
> 4 Open a web page and use the DOM Inspector to traverse the document tree
> and view all the attributes.
>
> An indispensable "learning|debugging" tool
>
>
> --
> Take care,
>
> Jonathan
> -------------------
> LITTLE WORKS STUDIO
> http://www.LittleWorksStudio.com



Great tip. Thank you. When I got thrown into web development about a month
ago, I installed IE, Firefox, Opera and Netscape to do cross-browser
debugging. After checking out the Firefox DOM Inspector, I find that the
other three also have DOM inspectors. I haven't had a chance to look at them
all yet. This will keep me busy for weeks.



 
Reply With Quote
 
Peter Michaux
Guest
Posts: n/a
 
      12-10-2006

Jonathan N. Little wrote:
> Peter Michaux wrote:
>
> > Or maybe even better than the DOM inspector is the
> > http://getfirebug.com plugin.

>
> Hmmm, looks interesting. Ain't innovation great! Support "Open Source".


Firebug saves me a lot of time and I sent some money. I hope others do
to and keep it alive for a long time.

Peter

 
Reply With Quote
 
Peter Michaux
Guest
Posts: n/a
 
      12-10-2006
Peter wrote:
>
> Great tip. Thank you. When I got thrown into web development about a month
> ago, I installed IE, Firefox, Opera and Netscape to do cross-browser
> debugging.


This is multi-browser debugging which is the practical approach but I
think your list needs Safari as it is distributed as the default
browser on all Macs. Safari has it's own set of oddities.

Peter

 
Reply With Quote
 
Peter
Guest
Posts: n/a
 
      12-10-2006
"Peter Michaux" <> wrote in message
news: ups.com...
> Peter wrote:
>>
>> Great tip. Thank you. When I got thrown into web development about a
>> month
>> ago, I installed IE, Firefox, Opera and Netscape to do cross-browser
>> debugging.

>
> This is multi-browser debugging which is the practical approach but I
> think your list needs Safari as it is distributed as the default
> browser on all Macs. Safari has it's own set of oddities.
>
> Peter


Is Safari available in a Windows version? I don't have a Mac available. I
checked the downloads at apple.com but didn't find anything.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please please please help this guy with his open source java app casioculture@gmail.com Java 4 05-05-2005 08:24 AM
Console profile for Windows app in VC++ - PLEASE PLEASE PLEASE HELP! MuZZy C++ 7 01-07-2005 08:40 PM
Computer problems please please please help Nick Computer Support 0 06-04-2004 08:49 PM
HELP! HELP! PLEASE, PLEASE, PLEASE tpg comcntr Computer Support 11 02-15-2004 06:22 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57