javascript lesson 7 / function to alert – confirm – prompt

html element
<p id=”popup_message”></p>


var controlMessage = function (){
alert(‘now you have been alerted that a message will appear on your screen!’);
var message;

var name = prompt(“please enter your name”,”your name”);

if(name != null) message = “Hello ” + name + ” “;

var confirmation_result = confirm(“please press a button”)
if(confirmation_result == true) message += “you pressed okay”;
else message += “you pressed cancel”;

document.getElementById(“popup_message”).innerHTML = message;



About Firat Karakusoglu

IIT Tech.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: