Hi dear welcome to "CodePrime" Blog . In this post YOU are going to learn Javascript Message Function | Document.write , alert, confirm, prompt | JS Tutorial. First Creat A index.html file Copy This HTML CODE and pest it one your code editor. 2ndly creat jmf.js file Then Copy The JS CODE and pest it then open the index.html file with your browser.
HTML CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="/jmf.js"></script>
<title>javascript</title>
</head>
<body>
<!-- <h2>Javascript Tutorial</h2>
<h3>By Codeprime</h3> -->
</body>
</html>
JAVASCRIPT CODE
//document example
document.write("code prime <br>")
//alert example
var a = alert("do you like our website ?");
document.write("thanks <br>");
//confirm example
var b = confirm("do you like our website ?");
if(b){
document.write("Thank you<br>")
} else{
document.write("sory to here that <br>")
}
//prompt example
var c = prompt("whats your name ?");
if(c){
document.write("welcome" + " " + c + "<br>");
}else{
document.write("sory to here that <br>" );
}
//<br> uses for line break all of message function you can do practice uing coment and uncoment of message parts.
0 Comments