SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Jul 15, 2003, 15:03 #1
- Join Date
- Nov 2001
- Location
- Maryland
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Accessing user-defined elements with JAvascript
This seems like such an easy concept, yet, I have struggled trying to find a solution. Is there a way to access a page element such as a <DIV>, since these tags are not considered objects?
Drew~Drew
There Is No Greater Joy Than Soaring High On The Wings Of Your Dreams, Except Maybe The Joy Of Watching A Dreamer Who Has Nowhere To Land But In The Ocean Of Reality.
-
Jul 15, 2003, 15:15 #2
- Join Date
- May 2002
- Location
- Relative
- Posts
- 452
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
HTML Code:<div id="mydiv"></div> <script language="JavaScript"> var oMyDiv = document.getElementById ( 'mydiv' ); </script>
Of course, that's just my opinion. I could be wrong.
-
Jul 15, 2003, 17:25 #3
- Join Date
- Sep 2002
- Location
- Bournemouth, South UK
- Posts
- 1,551
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
getElementsByTagName('div')[n] where n is the nth div on the screen. If you only have one div, the syntax would be getElementsByTagName('div')[0]
LiveScript: Putting the "Live" Back into JavaScript
if live output_as_javascript else output_as_html end if
-
Jul 16, 2003, 08:06 #4
- Join Date
- Nov 2001
- Location
- Maryland
- Posts
- 175
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks guys, those both did the trick.
Drew~Drew
There Is No Greater Joy Than Soaring High On The Wings Of Your Dreams, Except Maybe The Joy Of Watching A Dreamer Who Has Nowhere To Land But In The Ocean Of Reality.
Bookmarks