Okay, I'm still really new to javascript, so I'm looking for a little help. I
want to grab a name with I'm trying to display a hyperlink in my body, but one of
my functions overwrites it. The code is below. What am I doing wrong?
Thanks!
David
<html>
<head>
<title>
</title>
<script language="javascript" type="text/javascript">
var userName = "";
var randomMessage = "";
function loadPage()
{
userName = prompt("What is your name?", "Please enter your name");
if ((userName == "Please enter your name") || (userName == null))
{
userName = "Anonymous User";
}
document.writeln('Welcome to my web page, ' + userName);
}
function mouseIsOver(site)
{
mouseIsOverMessage = "This link will take you to www." + site;
window.status = mouseIsOverMessage;
}
function mouseIsOut(site)
{
mouseIsOutMessage = "Are you sure you don't want to give www." +
site + " a shot?";
window.status = mouseIsOutMessage;
}
function mouseHasClicked(site)
{
randomNumber = Math.floor(Math.random()*5);
switch (randomNumber)
{
case "0":
randomMessage = "Hang onto your butt, we're heading
to www." + site + "!";
break;
case "1":
randomMessage = "Destination: www." + site;
break;
case "2":
randomMessage = "www." + site + "? Energize!";
break;
case "3":
randomMessage = "Are you ready to visit www." + site
+ "? Here we go!";
break;
case "4":
randomMessage = "So, you think www." + site + " is
better?! Take a look";
break;
}
alert(randomMessage);
}
</script>
</title>
</head>
<body onLoad="loadPage();">
<h1 align="center">
Here are a few of my favorite links
</h1>
<hr />
<a href="http://www.slashdot.org" onMouseOver="mouseIsOver
('slashdot.org');" onMouseOut="mouseIsOut('slashdot.org');"
onClick="mouseHasClicked('slashdot.org');">
Slashdot
</a>
</body>
</html>
--
--------------------------------- --- -- -
Posted with NewsLeecher v3.9 Beta 1
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -