please dont rip this site

JScript / JavaScript Extension Feature

Returns a reference to the first object with the specified value of the ID attribute.


oElement = document.getElementById(sIDValue)


sIDValue Required. A String that specifies the value of an ID attribute.

Return Value

Returns the first object with the same ID attribute as the specified value.


If the ID value belongs to a collection, the getElementById method returns the first object in the collection.


This example uses the getElementById method to return the first occurrence of the ID attribute value, oDiv.

function fnGetId(){
   // Returns the first DIV element in the collection.
   var oVDiv=document.getElementById("oDiv1");
<DIV ID="oDiv1">Div #1</DIV>
<DIV ID="oDiv2">Div #2</DIV>
<DIV ID="oDiv3">Div #3</DIV>
<INPUT TYPE="button" VALUE="Get Names" onclick="fnGetId()">

Standards Information

This method is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .

Include the following to ensure getElementById is available even in a browser without native getElementById but with document.all (such as MSIE 4):

if (document.all && !document.getElementById) {
  document.getElementById = function(id) {
    return document.all[id] } }

See also:

file: /Techref/inet/iis/jscript/htm/getElementById.htm, 2KB, , updated: 2009/7/28 14:12, local time: 2024/6/24 23:41,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> getElementById</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!