Monday 16 July 2012

How to write javascript blocks


<!DOCTYPE html>
<html>
<body>

<h1>My Web Page</h1>

<p id="demo">A Paragraph.</p>

<p id="myDIV">A DIV.</p>

<button type="button" onclick="myFunction()">Try it</button>

<script type="text/javascript">
function myFunction()
{
document.getElementById("demo").innerHTML="Hello Boy";
document.getElementById("myDIV").innerHTML="How are you?";
}
</script>

</body>
</html>


Result:


My Web Page
A Paragraph.
A DIV.

0 Responses to “How to write javascript blocks”

Post a Comment