JavaScript prompt(), confirm(), alert()

Is a dynamic computer programming language.[5] It is most commonly used as part of web browsers, whose implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed.[5] It is also used in server-side network programming with runtime environments such as Node.js, game development and the creation of desktop and mobile applications.
Post Reply
dzcadii
Posts: 94
Joined: Sun Mar 01, 2015 4:36 am

JavaScript prompt(), confirm(), alert()

Post by dzcadii » Sun Mar 01, 2015 10:59 pm

JavaScript prompt(), confirm(), alert() functions

**Note**
To add a newline feed in a JavaScript popup use \n


//Prompt

Code: Select all

var say_yes = prompt("::ATTENTION::\nThis is a prompt! To separate lines use the \n\n\nSee\n\n\n3\n\n\nand type yes or no === string");
if(say_yes != "yes"){
alert("::ATTENTION::\nYou didn't say yes");
}
else{
alert("Great, you agreed");
}
//Confirm

Code: Select all

var say_yes = confirm("Will you say yes? === true");
if(say_yes){
alert("Cool! you said yes again === true");
}
else{
alert("You selected no === false");
}
**Note**
To add a newline feed in a JavaScript popup use \n


//Alert

Code: Select all

alert("::ATTENTION::\nThis is an alert! To separate lines use the \n\n\nSee\n\n\n3");

Post Reply