0% found this document useful (0 votes)
7 views1 page

Basic JavaScript Date Display Examples

This document contains 3 sections of HTML code that display the date in different ways. The first section uses a button click to display the date in a paragraph. The second writes the date directly into the HTML. The third uses JavaScript to display the date in a paragraph element.

Uploaded by

pavi3ra
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Basic JavaScript Date Display Examples

This document contains 3 sections of HTML code that display the date in different ways. The first section uses a button click to display the date in a paragraph. The second writes the date directly into the HTML. The third uses JavaScript to display the date in a paragraph element.

Uploaded by

pavi3ra
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

<html>

<head>
<script type="text/javascript">
function displayDate()
{
[Link]("demo").innerHTML
=Date();
}
</script>
</head>
<body>
<h1>My First Web Page</h1>
<p id="demo">This is a paragraph.</p>
<button type="button"
onclick="displayDate()">Display Date
</button>
</body>
</html>
.
<html>
<body>
<h1>My First Web Page</h1>
<script type="text/javascript">
[Link]("<p>" + Date() + "</p>");
</script>
</body>
</html>

<html>
<body>
<h1>My First Web Page</h1>
<p id="demo"></p>
<script type="text/javascript">
[Link]("demo").inne
rHTML=Date();
</script>
</body>
</html>

You might also like