Week 2 - 121v4a.htm

<SCRIPT>

var theURL = prompt("Please enter an HTTP Site", "http://espn.go.com");

if (theURL) {
     // indexOf String Method is used instead of the substring String Method
     //
Here we are saying if the indexOf() exists then ...
     if (theURL.indexOf("http://") == -1) theURL = "http://" + theURL ;
     document.
write("<CENTER>Go to " + theURL.link(theURL) + "</CENTER>");
}
else document.
write("<CENTER><B>You Canceled the Input</B></CENTER>");

</SCRIPT>