namshik
06-08-2005, 06:12 AM
i'm having trouble of implementing prompt errors with the drop down menu. the menu looks like this:
please select a genre
-----------
genre1
genre 2
what i need: selecting the header ("Please Select a Genre") or the spacing dashes causes a JavaScript alert box to appear telling the user that they have made an invalid selection and they must select one of the genres.
########### my head code###########
<script>
<!--
function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{
ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}
//-->
</script>
########### my body code###########
<form action="dummy" method="post"><select name="choice" size="1" onChange="jump(this.form)"><option value="error">Select a Genre</option><option value="error">---------------</option><option value="rock.html">Rock</option><option value="hiphop.html">Hip Hop</option><option value="classical.html">Classical</option></select></form>
please select a genre
-----------
genre1
genre 2
what i need: selecting the header ("Please Select a Genre") or the spacing dashes causes a JavaScript alert box to appear telling the user that they have made an invalid selection and they must select one of the genres.
########### my head code###########
<script>
<!--
function land(ref, target)
{
lowtarget=target.toLowerCase();
if (lowtarget=="_self") {window.location=loc;}
else {if (lowtarget=="_top") {top.location=loc;}
else {if (lowtarget=="_blank") {window.open(loc);}
else {if (lowtarget=="_parent") {parent.location=loc;}
else {parent.frames[target].location=loc;};
}}}
}
function jump(menu)
{
ref=menu.choice.options[menu.choice.selectedIndex].value;
splitc=ref.lastIndexOf("*");
target="";
if (splitc!=-1)
{loc=ref.substring(0,splitc);
target=ref.substring(splitc+1,1000);}
else {loc=ref; target="_self";};
if (ref != "") {land(loc,target);}
}
//-->
</script>
########### my body code###########
<form action="dummy" method="post"><select name="choice" size="1" onChange="jump(this.form)"><option value="error">Select a Genre</option><option value="error">---------------</option><option value="rock.html">Rock</option><option value="hiphop.html">Hip Hop</option><option value="classical.html">Classical</option></select></form>