#JavaScript OutPut
JavaScript Display Possibilities
JavaScript can display data in different ways:
- Writing into an HTML element, Using innerHTML.
- Writing into the HTML output, Using document.write().
- Writing into an alert box, Using window.alert() or alert().
- Writing into the browser console, Using console.log().
Using inner HTML
To access an HTML element, JavaScript can use the document.getElementById("ID") method. The ID attribute defines the HTML element. The innerHTML property defines the HTML content:
Using document.write()
For testing purposes, It is convenient to use document.wrtie():
Using the document.write() after an HTML document is fully loaded, will delete all existing HTML:
Using Window.alert()
I can use an alert box to display data:
Using document.write()
For debugging purposes, I can use the console.log() method to display data.
No comments:
Post a Comment