Jump to content

Need help with GetElementById


vytas

Recommended Posts

Where can i find a good tutorial about the GetElementById and where is it good for ?Thank you :)Tryit EditorPls show me a example

Link to comment
Share on other sites

getElementById() is used for an easy way to access and modify things in the document.Example:

var tb = document.getElementById("my_table");var body = document.getElementByTagName("BODY");if(tb.parentNode == "body"){document.write("The table is in the right place");

You're asking for a specific table that has a parent of body, meaning it's not embedded in any tags.You can probably get the same result with getElementByTagName() and a loop but that's what getElementById() can be used for.

Link to comment
Share on other sites

let's see ive i get it Ive i give my things an id like this<input type="button"value="button"id="button">document.GetElementById("button")Is that the right way ?ive thats true then i want to ask another question how can i get to the css of my page with GetElementById ???¿¿¿???

Link to comment
Share on other sites

Check out the HTML DOM tutorials for more information on how to manipulate the properties of elements using the DOM.To get at the CSS for an element, you can either use "className" to get the css class for an element or you can use "style" to get at any of the styles. Look here for more information on using "style":http://www.w3schools.com/htmldom/dom_obj_style.aspKeep in mind that it's getElementById and not GetElementById.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...