Page 1 of 1
Javascript: Document Object Model
Posted: Wed Jun 16, 2004 10:56 am
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
Posted: Wed Jun 16, 2004 12:03 pm
by feyd
Code: Select all
for(var x in window)
{
document.write('window.'+x+' = '+windowїx]+'<br />\n');
}
or something like it..
Argh!
Posted: Wed Jun 16, 2004 12:07 pm
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
Posted: Wed Jun 16, 2004 12:27 pm
by d3ad1ysp0rk
feyd wrote:Code: Select all
for(var x in window)
{
document.write('window.'+x+' = '+windowїx]+'<br />\n');
}
or something like it..
Think function list. Sorta like a php.net for javascript.
Btw, I don't know of one, sorry.
Posted: Wed Jun 16, 2004 12:28 pm
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?
Posted: Wed Jun 16, 2004 12:29 pm
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) { return document.getElementById?document.getElementById(id):document.allїid]; }
now to get the text contained therein
Code: Select all
var obj = getElem('someparagraph');
var text = '';
if(obj != null)
text = obj.innerHTML;
Posted: Wed Jun 16, 2004 12:32 pm
by magicrobotmonkey
But still.. I'd like to see that listing as well.
Posted: Wed Jun 16, 2004 12:35 pm
by feyd
Posted: Wed Jun 16, 2004 12:43 pm
by magicrobotmonkey
nice!
Posted: Wed Jun 16, 2004 12:44 pm
by feyd
just have to know what to search for.. like that one: javascript's real name is ECMAscript.
Posted: Wed Jun 16, 2004 12:57 pm
by magicrobotmonkey
I was not aware of that.
Posted: Wed Jun 16, 2004 1:06 pm
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.