Contoh
membuat menu dropdown atau pulldown seperti diatas adalah sebagai berikut
<script language="JavaScript">
function pulldown_menu() { //
Create a variable url to contain
the value of the // selected
option from the the form
named pulldown and variable
selectname var url = document.p
ulldown.selectname.options [do
cument.pulldown.selectname.sel
ectedIndex].value
// Re-direct the browser to the
url value window.location.href =
url } </script>
<center>
<form name="pulldown">
<select name="selectname"
SIZE="1"> <option
value="">Select A Site</option>
<option value=
"
http://www.yahoo.com
">Yahoo.com</option>
<option value=
"
http://www.goto.com
">Goto.com</option> <option
value=
"
http://www.altavista.com
">AltaVista</option> <option
value=
"http://www.go.com
">Go.com</option> <option
value=
"http://www.msn.com
">MSN.com</option>
</select> <input type="button"
value="Go" onClick="JavaScript:p
ulldown_menu()"> </form>
</center>
0 komentar:
Posting Komentar