|
Posted by Jonathan N. Little on 12/10/06 16:08
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
Navigation:
[Reply to this message]
|