Changing HTML Elements
The example below writes the current date into an existing <p> element in the HTML document:
Example
<html>
<body>
<h1>My First Web Page</h1>
<p id="demo"></p>
<script type="text/javascript">
document.getElementById("demo").innerHTML=Date();
</script>
</body>
</html>
your result
My First Web Page
Wed Feb 23 01:47:28 2011
The example below writes the current date into an existing <p> element in the HTML document:
Example
<html>
<body>
<h1>My First Web Page</h1>
<p id="demo"></p>
<script type="text/javascript">
document.getElementById("demo").innerHTML=Date();
</script>
</body>
</html>
your result
My First Web Page
Wed Feb 23 01:47:28 2011