Assignment 14: A Possible Answer


<SCRIPT LANGAUGE="javascript">

function alertwithhello()


var first = prompt("What is your first name?", "")
var last = prompt("What is you last name?", "")

var page = document.location;
var ttl = document.title;

alert("Hi " +first+ " " +last+ ". Welcome to " +ttl+ ", " +page+".")



     And this was the BODY command from the document:

<body bgcolor="ffffcc" onLoad="alertwithhello()">


Gives you the alert box:

     Reload to see the effect again.

     This one required you to think it through a bit. There had to be at least two prompt commands. One just followed the other. Then variable out something that would post "My great page". We did it by putting that text in the title and making a variable for the "document.title" command. Then you had to variable out the "document.location".
     Then we put it all together in an "alert" command.


Did You Get It?


Back to the Index Page