M7 IA1 Task1 Exercise1 Irene Arroyo

This exercise is about control pass.

We must do a pop up box asking the user name and the age, if the user is 18 or older, the page allow the user to see a website, if it’s under 18 the website is not going to show.

Code

<html>
<html>
<head>
<script>

let name = prompt(“Please enter your name”);

let age = prompt ( “How old are you?” );

if ( age >= 18) {

location.href = ‘https://playmax.mx/it-f42042-dc=o4c7c8t5s6m8’;
alert (” Okay ” + name + “, get ready to play!” ); }

else { alert ( ” Sorry ” +  name + “. You aren’t old enough to play this game!”); }

</script>
</head>
<body>
</body>

Exercise 1 | Control Pass

Leave a Reply

Your email address will not be published. Required fields are marked *