Java Reference
In-Depth Information
Page 7 - Summary</option>
</select></center>
As you can see from the above code, the
<select>
tag contains an
onchange
at-
tribute. This attribute tells the browser to execute the
menuLink
function when the value
of the choice list changes. Each of the
<option>
tags contains a link to the page that the
user is requesting.
Using this information, the
menuLink
function can navigate to the correct page.
The
menuLink
function is contained inside of a beginning
<script>
and ending
</script>
tag. You can see this code here:
<script type="text/javascript">
function isValidUrl( url )
{
return !(typeof(url)=="undefined" || url==null ||
url=="" || url.toLowerCase()=="none" ||
url.toLowerCase()=="null" || url=="-1");
}
function openPopup( url, width, height, name, left, top )
{
if (isValidUrl(url))
window.open(url, ((name&&name!="")?name:"popup"),
((width&&width!="")?"width="+width+",":"")+
((height&&height!="")?"height="+height+",":"")+
"status=no,toolbar=no,menubar=no,location=no," +
"scrollbars=yes,resizable=yes"
+((left&&left!="")?",left="+left:"")+((top&&top!="")?
",top="+top:""));
}
function menuLink( menu )
{
var link = menu.options[menu.selectedIndex];
var url = link.value;
var target = link.target;
if (link.popup == "true")
{
openPopup(url, link.popupwidth, link.popupheight, target);
}
else if (isValidUrl(url))
{
if (url.indexOf("javascript:") != -1)
{
eval(url.substr(url.indexOf(":")+1));
} else if (target && target != "")