Snack's 1967

JAVASCRIPT getElementById, getElementByTagname ::

JAVASCRIPT getElementById, getElementByTagname ::

JAVASCRIPT getElementById, getElementByTagname ::
(PERHATIKAN huruf besar, fungsi di javas JS benar benar case sensitif)


CARI: JAVASCRIPT getElement DIDAPAT:
BIKIN ARTIKEL:: JavaScript: Get Elements by ID, Tag, Name, Class (LENGKAP:: http://xahlee.info/js/jsgetelements.html http://xahlee.org/ website

Name, TagName & Get Elements by ClassName berupa multi object /array, jadi harus ditunjuk di index yg keberapa. utk yg pertama::
xyz[0].style.color="red"; xyz[1].style.color="blue" ;

something

// id sudah tertentu, TIDAK perlu index yg keberapa
var myObj = document.getElementById("xyz"); myObj.style.color="red"; // change color to red
---Disqus is a global comment system that improves discussion on websites and connects conversations across the web (bisa kasih comment scr global dr seluruh website mana saja)

Use OBJ.getAttribute ‹node›.getAttribute(‹attribute name›) to get a element's attribute. The ‹attribute name› should be a string. The ‹node› is a HTML element object.
sample element

var xx = document.getElementById("id46570"); var mytitle = xx.getAttribute("title"); alert("title is " + mytitle);

var xx = document.getElementById("id46570"); var mytitle = xx.getAttribute("title"); document.href = "title is " + mytitle ; //TULIS ke addressBar

-x document.href was deprecated because it may conflict with the window.location
Netscape 6 drops support for this property entirely. Use either the document.URL OR window.location.href ---(window.) location.href = returns the entire URL of the current page
history.go(0) history.go("")
href ----- Sets or returns the entire URL
di Mozilla ketikkan di URLbar == view-source: http://www.yahoo.com (javascript - Set iFrame source to "view-source: {URL}" not working

location.href = "view-source: http://www.yahoo.com"

Back to posts
Comments:

Post a comment