JavaScript Output
JavaScript does not have any print or output functions.
In HTML, JavaScript can only be used to manipulate HTML elements.
Manipulating HTML Elements
To access an HTML element from JavaScript, you can use the document.getElementById(id) method.Use the id attribute to identify the HTML element, and innerHTML to refer to the element content:
______________________________________________________________________________
Example
<!DOCTYPE html>
<html>
<body>
<h1>My First Web Page</h1>
<p id="demo">My First Paragraph</p>
<script>
document.getElementById("demo").innerHTML = "Paragraph changed.";
</script>
</body>
</html>
<html>
<body>
<h1>My First Web Page</h1>
<p id="demo">My First Paragraph</p>
<script>
document.getElementById("demo").innerHTML = "Paragraph changed.";
</script>
</body>
</html>
_______________________________________________________________________________
The JavaScript statement above (inside the
An American USA Based Company Provide you the best Custom Packaging Boxes
ReplyDelete