Javascript: Document Object Model

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
randomblink
Forum Commoner
Posts: 51
Joined: Wed Jan 28, 2004 11:27 am
Location: Tulsa, Oklahoma, just this side of hell...
Contact:

Javascript: Document Object Model

Post by randomblink »

Alright...
I have spent SEVERAL hours searching, fruitlessly, through the web for a plain text listing of the Javascript DOM.

I am looking for something similar to:

Code: Select all

Javascript
window
window.method
window.property
window.property.method
Basically, something that would list out EVERYTHING I can access via Javascript. I have found NOTHING resembling that... Surely SOMEONE has needed this and made one? I have a multiple-thousand page book AT HOME that does something similar... But surely SOMEONE has compiled a complete listing?

I use Edit Plus 2 to do my Javascript and sometimes I would like to just have a simple look-see at an object to see related properties and methods and methods of properties, etc...

If someone can help me it would be GREATLY appreciated...
Thanks in advance
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

for(var x in window)
{
  document.write('window.'+x+' = '+window&#1111;x]+'<br />\n');
&#125;
or something like it..
randomblink
Forum Commoner
Posts: 51
Joined: Wed Jan 28, 2004 11:27 am
Location: Tulsa, Oklahoma, just this side of hell...
Contact:

Argh!

Post by randomblink »

No... feyd, you answered my question...
I just didn't ask the right one...

What I mean is:

I am trying to write some functions.
I need to know how to access the text inside a paragraph element.

For instance:
<p>some text</p>

I need to know how to grab that through the dom.
So I need a listing like:
document.aLinkColor
document.anchors[]
document.applets[]
...etc...

Then I can dig through it to find the DOM necessary to grab text from inside an element...

I am looking for a listing of sorts, not HOW to list all the elements in a specific HTML Document...

Does that make better sense...? You would think I would write better questions instead of just more... ugh!

Thanks tho feyd
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

feyd wrote:

Code: Select all

for(var x in window)
&#123;
  document.write('window.'+x+' = '+window&#1111;x]+'<br />\n');
&#125;
or something like it..
Think function list. Sorta like a php.net for javascript.

Btw, I don't know of one, sorry.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

Hmm.. I would think look at IE sites. Javascript is done by the browser, so I think you might be able to find something at browser sites?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

elementReference.innerText or elementReference.innerHTML

elementReference is an object of that HTML element.. so for your <p> example.. it's easiest to grab it if it has a unique designation in the page.. like an ID..

Code: Select all

<p id="someparagraph">blahlbah text inside</p>
now the javascript to get the object..

Code: Select all

function getElem(id) &#123; return document.getElementById?document.getElementById(id):document.all&#1111;id]; &#125;
now to get the text contained therein

Code: Select all

var obj = getElem('someparagraph');
var text = '';

if(obj != null)
text = obj.innerHTML;
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

But still.. I'd like to see that listing as well.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

nice!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

just have to know what to search for.. like that one: javascript's real name is ECMAscript.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

I was not aware of that.
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

These are the two links I use a lot when working with javascript:

http://msdn.microsoft.com/library/defau ... _entry.asp

http://devedge.netscape.com/library/man ... reference/

btw. the pdf feyd posted looks interesting as well. thanks.

Greetz Jolly.
Post Reply