Phiên bản đầy đủ: jsB@nk » Trình đơn » Định hướng » Định hướng bởi nút radio 2
URL: https://www.javascriptbank.com/navigation-by-radio-buttons-ii.html
Hiệu ứng tạo một menu chọn có chú thích kiểu radio, muốn chuyển đến địa chỉ nào đó bạn nhấp chuột chọn tên tương ứng và nhấn nút Let's Go!.
Phiên bản đầy đủ: jsB@nk » Trình đơn » Định hướng » Định hướng bởi nút radio 2
URL: https://www.javascriptbank.com/navigation-by-radio-buttons-ii.html
<SCRIPT language=JavaScript><!-- Activate Cloaking Devicevar recnum="";// Used to initialize arrays.function initArray() { this.length = initArray.arguments.length; for (var i = 0; i < this.length; i++) { this[i] = initArray.arguments[i]; } }// Creating arrays.var rcrd = new initArray();var address = new initArray();rcrd[1] = "Home Page\r\nThe home page of this site.";address[1] = "JavaScriptBank.com";rcrd[2] = "Contents\r\nA listing of the contents of this site.";address[2] = "JavaScriptBank.com";rcrd[3] = "Navigation Aids\r\nExamples of various ways to make navigation of your site easier.";address[3] = "JavaScriptBank.com";rcrd[4] = "A Dropdown List\r\nAn example of a dropdown list for site navigation.";address[4] = "JavaScriptBank.com";// Called by onClick for each radio button - determines & displays message and URL.function dataBase(leapto) { for (var i = 0; i < 4; i++) { if (leapto.buttons[i].checked) { recnum = leapto.buttons[i].value; } } if ( (rcrd[recnum] != null) && (rcrd[recnum] != "") ) { document.leapto.display.value = rcrd[recnum]+"\r\n\r\n"+address[recnum]; } }// Called by Lets Go button - loads pre-selected page.function leapTo() { if ( (address[recnum] != null) && (address[recnum] != "") && (recnum != "") ) window.location= address[recnum]; else alert("\nYou must first select a radio button."); }// Deactivate Cloaking --></SCRIPT><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<FORM name=leapto><TABLE border=3> <TBODY> <TR> <TD align=middle bgColor=#000080><INPUT onclick=dataBase(this.form) type=radio value=1 name=buttons> <font color="#00FFFF"><b>JavaScriptBank.com</b></font></TD> <TD align=middle bgColor=#ff0000><INPUT onclick=dataBase(this.form) type=radio value=2 name=buttons> <b>Link item #</b></TD> <TD align=middle bgColor=#c0c0c0><INPUT onclick=dataBase(this.form) type=radio value=3 name=buttons> <font color="#800000"><b>Link item #</b></font></TD> <TD align=middle bgColor=#008080><INPUT onclick=dataBase(this.form) type=radio value=4 name=buttons> <font color="#FFFF00"><b>Link item #</b></font></TD></TR></TBODY></TABLE><BR><BR><TABLE border=0> <TBODY> <TR> <TD align=middle width=350><TEXTAREA name=display rows=6 wrap=yes cols=25></TEXTAREA></TD> <TD align=middle width=150><INPUT onclick=leapTo() type=button value="Let's Go!"></TD></TR></TBODY></TABLE></FORM><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->