Posted by: Sourav | July 3, 2013

Getting input using confirm in Javascript


<html>
<head>
<title>

Javascript Example
</title>
<script type=”text/javascript”>
function confirmation(answer)
{
var result=””;
if(answer)
{
result=”Let’s Play”;
}
else
{
result=”Ok Later”;
}
return result;
}

</script>

</head>
<body>

<script type=text/javascript>

var theanswer=confirmation(confirm(“Shall we play a game?”));
alert(theanswer);

</script>

</body>

</html>

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Categories

%d bloggers like this: