tomtimus
06-03-2004, 08:41 AM
Okay..i have the drop down menu...and I'm trying to make it so when you select "choose a genre" or "-------" an alert box pops up saying "please choose"...I'm 99.99% sure that my error is in the javascript part of the html...thnx for helping a beginner!
This is what I have:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Tom's Music Page</title>
<link rel="stylesheet" type="text/css" href="intro.css" />
<script language="Javascript">
function go()
{
if ( location=document.drop.mus.option[document.drop.mus.selectedIndex].asdf return
alert('Choose Again');
else
location=document.drop.mus.options[document.drop.mus.selectedIndex].value;
}
</script>
</head>
<body>
<h1>Choose A Genre!</h1>
</ br>
<img src="piano.jpg" width="502" alt="" />
<form name="drop">
<select name="mus" onChange="go()">
<option value="asdf">Choose a Genre!</option>
<option value="asdf">-------------</option>
<option value="page1.html">Hip-Hop</option>
<option value="page2.html">Alternative</option>
<option value="page3.html">Classical</option>
<option value="asdf">-------------</option>
<option value="index.html">Home!</option>
</select>
</form>
</body>
</html>
This is what I have:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Tom's Music Page</title>
<link rel="stylesheet" type="text/css" href="intro.css" />
<script language="Javascript">
function go()
{
if ( location=document.drop.mus.option[document.drop.mus.selectedIndex].asdf return
alert('Choose Again');
else
location=document.drop.mus.options[document.drop.mus.selectedIndex].value;
}
</script>
</head>
<body>
<h1>Choose A Genre!</h1>
</ br>
<img src="piano.jpg" width="502" alt="" />
<form name="drop">
<select name="mus" onChange="go()">
<option value="asdf">Choose a Genre!</option>
<option value="asdf">-------------</option>
<option value="page1.html">Hip-Hop</option>
<option value="page2.html">Alternative</option>
<option value="page3.html">Classical</option>
<option value="asdf">-------------</option>
<option value="index.html">Home!</option>
</select>
</form>
</body>
</html>