Writing to The HTML Document
The example below writes a
element with current date information to the HTML document:
lihat gambar 1 :
gambar 1
Note: Try to avoid using document.write() in real life JavaScript code. The entire HTML page will be overwritten if document.write() is used inside a function, or after the page is loaded. However, document.write() is an easy way to demonstrate JavaScript output in a tutorial.
Changing HTML Elements
The example below writes the current date into an existing
element:
lihat gambar 2 :
gambar 2
Note: To manipulate HTML elements JavaScript uses the DOM method getElementById(). This method accesses the element with the specified id.
0 comments:
Posting Komentar