Define a function named "myFunction", and make it display "Hello World!" in the <p> element. - Javascript Function

Javascript examples for Function:Quiz

Description

Define a function named "myFunction", and make it display "Hello World!" in the <p> element.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="demo"></p>

<script>
function myFunction() {/*  ww w .  ja va 2 s.co  m*/
    document.getElementById("demo").innerHTML = "Hello World!";
}
myFunction();
</script>

</body>
</html>

Related Tutorials