»
Tiếng AnhTiếng PhápTiếng Việt

In - Tạo menu sổ dọc - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Ứng dụng » Công cụ xuất » Tạo menu sổ dọc
URL: https://www.javascriptbank.com/drop-down-menu-generator.html

Tạo menu sổ dọc © JavaScriptBank.comMột chương trình tạo trình đơn sổ dọc đơn giản trên trang web.

Phiên bản đầy đủ: jsB@nk » Ứng dụng » Công cụ xuất » Tạo menu sổ dọc
URL: https://www.javascriptbank.com/drop-down-menu-generator.html



JavaScript
<script language="JavaScript"><!--  Beginfunction MakeIt(form){var txt='';txt+=form.java.value+'\r\n';txt+='<form name="'+form.name.value+'">\r\n';txt+='<select name="dropdownmenu" size=1 onChange="goToURL(this.form)">\r\n';txt+='<option selected value="">\r\n';txt+=form.name.value+'\r\n';txt+='<option value="'+form.url1.value+'">\r\n';txt+=form.page1.value+'\r\n';txt+='<option value="'+form.url2.value+'">\r\n';txt+=form.page2.value+'\r\n';txt+='<option value="'+form.url3.value+'">\r\n';txt+=form.page3.value+'\r\n';txt+='<option value="'+form.url4.value+'">\r\n';txt+=form.page4.value+'\r\n';txt+='<option value="'+form.url5.value+'">\r\n';txt+=form.page5.value+'\r\n';txt+='</select></form>';form.code.value=txt;}function ResetPage(form){if(confirm("Do you wish to start over?")){form.name.value="";form.url1.value="";form.url2.value="";form.url3.value="";form.url4.value="";form.url5.value="";form.page1.value="";form.page2.value="";form.page3.value="";form.page4.value="";form.page5.value="";   }}// End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<script language="JavaScript"><!-- function goToURL(form)  {    var myindex=form.dropdownmenu.selectedIndex    if(!myindex=="")      {        window.location.href=form.dropdownmenu.options[myindex].value;            }}//-->  </script><form name="Form Name ">  Here&#39;s an example using the titles below &gt;&gt;&gt;&gt;   <select name="dropdownmenu" size="1" onchange="goToURL(this.form)"><option selected="selected">Form Name </option><option value="http://www.searchbliss.com/javamenu.htm">Name of 1st Selection     </option><option value="http://www.searchbliss.com/javamenu.htm">Name of 2nd Selection     </option><option value="http://www.searchbliss.com/javamenu.htm">Name of 3rd Selection     </option><option value="http://www.searchbliss.com/javamenu.htm">Name of 4th Selection     </option><option value="http://www.searchbliss.com/javamenu.htm">Name of 5th Selection     </option></select>  This example is linked to this page. </form><form action="">  <div align="center">    <table bgcolor="#ffffff" border="2" cellpadding="4" width="690" height="314" bordercolorlight="#FFFFFF" bordercolordark="#555555">      <tbody><tr>         <td width="287">           <div align="center"><font size="3" face="arial" color="#555555"><b>Form Name <br>            <font size="-2" color="#333333">(The title displayed on menu)</font></b>             </font></div>        </td>        <td align="center" width="373"><font size="2"><b>           <input type="hidden" name="java" value="&lt;script language=&quot;JavaScript&quot;&gt;&lt;!-- function goToURL(form)  {    var myindex=form.dropdownmenu.selectedIndex    if(!myindex==&quot;&quot;)      {        window.location.href=form.dropdownmenu.options[myindex].value;            }}//--&gt;&lt;/script&gt;&lt;!--Paste code above between your head tags--&gt;&lt;!--Paste code below between your body tags--&gt;">          <input type="text" name="name" size="58">          </b></font> </td>      </tr>      <tr>         <td align="center" width="287"><font size="3" face="arial"><b> <font size="3" face="arial" color="#555555">URL of </font><font size="3" face="arial" color="#555555">1st Selection           <br>          <font size="-2" color="#333333">(e.g. http://www.domain.com/page1.htm)</font>           </font> </b></font></td>        <td align="center" width="373"><font size="2"><b>           <input type="text" name="url1" size="58">          </b></font> </td>      </tr>      <tr>         <td width="287">           <div align="center"><font size="3" face="arial" color="#555555"> <b>Name of 1st Selection<br>            <font size="-2" color="#333333">(Menu option 1)</font> </b> </font></div>        </td>        <td align="center" width="373"><b>           <input type="text" name="page1" size="58">          </b></td>      </tr>      <tr>         <td width="287">           <div align="center"><font size="3" face="arial" color="#555555"><b>URL of 2nd Selection<br>            </b></font><font size="-2" face="arial" color="#333333"><b>(e.g. http://www.domain.com/page2.htm)             </b></font><font size="3" face="arial" color="#555555"><b> </b></font>           </div>        </td>        <td align="center" width="373"><font size="2"><b>           <input type="text" name="url2" size="58">          </b></font></td>      </tr>      <tr>         <td width="287" height="13">           <p align="center"><font size="3" face="arial" color="#555555"><b>Name of 2nd Selection<br>            <font size="-2" color="#333333">(Menu option 2)</font> </b> </font>           </p>        </td>        <td align="center" width="373" height="13">           <p>          <b>             <input type="text" name="page2" size="58">          </b>                   </p></td>      </tr>      <tr>         <td width="287" height="2">           <div align="center"><font size="3" face="arial" color="#555555"><b>URL of 3rd Selection<br>            </b></font><font size="-2" face="arial" color="#333333"><b>(e.g. http://www.domain.com/page3.htm)             </b></font></div>        </td>        <td align="center" width="373" height="2"><font size="2"><b>          <input type="text" name="url3" size="58">          </b></font></td>      </tr>      <tr>         <td width="287" height="2">           <div align="center"><font size="3" face="arial" color="#555555"><b>Name of 3rd Selection<br>            <font size="-2" color="#333333">(Menu option 3)</font> </b> </font></div>        </td>        <td align="center" width="373" height="2"><font size="2"><b>          <input type="text" name="page3" size="58">          </b></font></td>      </tr>      <tr>         <td width="287" height="2">           <div align="center"><font size="3" face="arial" color="#555555"><b>URL of 4th Selection<br>            </b></font><font size="-2" face="arial" color="#333333"><b>(e.g. http://www.domain.com/page4.htm)             </b></font></div>        </td>        <td align="center" width="373" height="2"><font size="2"><b>          <input type="text" name="url4" size="58">          </b></font></td>      </tr>      <tr>         <td width="287" height="2">           <p align="center"><font size="3" face="arial" color="#555555"><b>Name of 4th Selection<br>            <font size="-2" color="#333333">(Menu option 4)</font> </b></font><font size="3" face="arial"><b>             </b></font></p>        </td>        <td align="center" width="373" height="2"><font size="2"><b>          <input type="text" name="page4" size="58">          </b></font></td>      </tr>      <tr>         <td width="287" height="2">           <div align="center"><font size="3" face="arial" color="#555555"><b>URL of 5th Selection<br>            </b></font><font size="-2" face="arial" color="#333333"><b>(e.g. http://www.domain.com/page5.htm)             </b></font></div>        </td>        <td align="center" width="373" height="2"><font size="2"><b>          <input type="text" name="url5" size="58">          </b></font> </td>      </tr>      <tr>         <td width="287" height="2">           <div align="center"><font size="3" face="arial" color="#555555"><b>Name of 5th Selection<br>            <font size="-2" color="#333333">(Menu option 5)</font> </b></font></div>        </td>        <td align="center" width="373" height="2"><font size="2"><b>          <input type="text" name="page5" size="58">          </b></font> </td>      </tr>      <tr>         <td width="287" height="2">           <div align="center">             <p align="center"><font size="3" face="arial"><b>               <input type="button" value="Create Drop-Down Menu" onclick="MakeIt(this.form);" name="button">              </b></font> <br>              <input type="button" name="Button" value="Select  Code" onclick="this.form.code.select();             this.form.code.focus()">            </p>            <p align="center"><font size="1"> <a href="http://www.searchbliss.com/">SearchBliss</a>               / 2001</font></p>          </div>        </td>        <td align="center" width="373" height="2">           <div align="center"><font size="2" color="#ffffff"><b>             <textarea name="code" rows="6" cols="50"></textarea>            </b></font></div>        </td>      </tr>    </tbody></table>  </div></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->