javascript confirm function methode
first create your html file and put this code and see result
<body>
<button onclick="confirmation()">Confirm</button>
</body>
<script>
function confirmation(){
var answer=confirm("are you sure leave this site");
if(answer){
alert("Thanck's");
window.location="http://www.google.com";
}
else{
alert("Thanck's to stay in my blog");
};
};
</script>
Example
Javascript prompt Function Methode
first create html file and put this code in html,and see result
<body>
<button onclick="prompter()">Prompt</button>
</body>
<script>
function prompter(){
var answer=prompt("what's your name");
if(answer){
alert("my name is "+answer);
};
else{
alert("prompt function not execute");
};
};
</script>
Post a Comment