Menu(Option) Generator : JavaScript DHTML examples (example source code) » Form Control » Option Select ComboBox

JavaScript DHTML
C++
Java Products
Java Articles
JavaScript DHTML Home  »   Form Control   » [  Option Select ComboBox  ]   
 



Menu(Option) Generator

Please note that some example is only working under IE or Firefox.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Qiksearch MenuGen</title>
<style type="text/css">
.link{font-family:verdana,arial,helvetica; font-size:8pt; color:#003399; font-weight:normal}
.link:hover{font-family:verdana,arial,helvetica; font-size:8pt; color:#0099FF; font-weight:normal}
</style>
</head>
<body bgcolor="#FFFFFF" onload="this.document.qiksearch.select_items.selectedIndex = 4">
<center><span style="font-family:arial,verdana,helvetica; font-weight:bold; color:#808080; font-size:34pt">Qiksearch</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-family:arial,verdana,helvetica; font-weight:bold; color:#DD0000; font-size:34pt">MenuGen</span></center>
<script language="javascript">
// Location of this script:
// http://www.qiksearch.com/javascripts/menugen.htm
//*********************************************
//* Qiksearch MenuGen                         *
//* Javascript Drop-Down Menu Creator         *
//* (c) Premshree Pillai,                     *
//* http://www.qiksearch.com                  *
//* E-mail : [email protected]            *
//* Created on 03/14/02                       *
//* Use the script freely as long as          *
//*           credits are maintained          *
//* Visit www.qiksearch.com/javascripts.htm   *
//*                    for more FREE scripts  *
//*********************************************

var no_options;

document.write('<table cellspacing="5" cellpadding="5" style="border:2 solid #808080" align="center"><tr><td>');
document.write('<table width="100%" cellspacing="0" cellpadding="1" bgcolor="#808080" style="border:2 solid #CCCCCC; font-family:verdana,arial,helvetica; font-size:8pt"><tr><td align="middle"><a href="javascript:about()"><font color="#FFFFFF" style="text-decoration:none">About</font></a></td><td bgcolor="#FFFFFF"></td><td align="middle"><a href="javascript:help()"><font color="#FFFFFF" style="text-decoration:none">Help</font></a></td><td bgcolor="#FFFFFF"></td><td align="middle"><a href="mailto:[email protected]"><font color="#FFFFFF" style="text-decoration:none">Contact</font></a></td><td bgcolor="#FFFFFF"></td><td align="middle"><a href="http://www.qiksearch.com"><font color="#FFFFFF" style="text-decoration:none">Qiksearch</font></a></td></tr></table>');
document.write('<form name="qiksearch">');
if(navigator.appName=="Microsoft Internet Explorer")
{
 document.write('<font face="verdana,arial,helvetica" size="-1" color="#000000">Display <select name="select_items" onchange="javascript:showItems(this.document.qiksearch.select_items.value)" style="font-size:8pt">');
 for(var i=1; i<=30; i++)
 {
  document.write('<option value="' + i + '">' + i + '</option>');
 }
 this.document.qiksearch.select_items.selectedIndex = 4;
 document.write('</select> links.<br><br>');
}

document.write('<b>Combo Caption :</b><br><br>');
document.write('<input type="text" value="Select" name="combo_caption" size="30" style="height:20; border:1 solid #000000">');
document.write('<br><br><b>Combo Items :</b><br><br>');
document.write('<div id="items">');
for(var i=1; i<=5; i++)
{
 document.write('Option : <input type="text" size="12" name="option' + i + '" style="height:20; border:1 solid #000000"> Link to : <input type="file" name="linkto' + i + '" size="15" style="height:20; border:1 solid #000000"><br>');
}
document.write('</div>');
document.write('<br><center><input type="button" name="qiksearch_submit" value="Make My Code" onclick="display()" style="font-family:verdana,arial,helvetica; font-size:8pt; height:20; width:48%; background:#EFEFEF; border:1 solid #808080; cursor:hand"> <input type="reset" onclick="javascript:location.reload();" style="font-family:verdana,arial,helvetica; font-size:8pt; height:20; width:48%; background:#EFEFEF; border:1 solid #808080; cursor:hand"></center>');
document.write('<br><font size="-2">&#1692002 <a href="mailto:[email protected]"><font face="verdana,arial,helvetica" size="-2" color="#000000">Premshree Pillai</font></a>. All rights reserved.</font></font></form>');

document.write('</td></tr></table>');

function showItems(n)
{
 var item_disp = "";
 for(var i=0; i<n; i++)
 {
  item_disp += 'Option : <input type="text" size="12" name="option' + (i+1) + '" style="height:20; border:1 solid #000000"> Link to : <input type="file" name="linkto' + (i+1) + '" size="15" style="height:20; border:1 solid #000000"><br>';
 }
 no_options=n;
 this.document.all.items.innerHTML = item_disp;
}

if(navigator.appName=="Microsoft Internet Explorer")
{
 no_options = this.document.qiksearch.select_items.value;
}
else
{
 no_options = 5;
}

function display() {
   DispWin=window.open('','NewWin',
   'toolbar=no,status=no,width=500,height=375')
   message="<font face=arial,verdana,helvetica size=-2 color=#000000><b>&lt;!--Made with Qiksearch MenuGen--&gt;";
   message += "<br>&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;";
   message += "<br>function go()";
   message += "<br>{";
   message += "<br>&nbsp;if (document.selecter.select1.options[document.selecter.select1.selectedIndex].value != &quot;none&quot;)";
   message += "<br>&nbsp;{";
   message += "<br>&nbsp;&nbsp;location = document.selecter.select1.options[document.selecter.select1.selectedIndex].value";
   message += "<br>&nbsp;}";
   message += "<br>}";
   message += "<br>&lt;/script&gt;";
   message += "<br>";
   message += "<br>&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;";
   message += "<br>document.write('&lt;form name=&quot;selecter&quot;&gt;&lt;select name=&quot;select1&quot;&gt;');";
   message += "<br>document.write('&lt;option value=none&gt;" this.document.qiksearch.combo_caption.value + "&lt;/option&gt;');";
   message += "<br>document.write('&lt;option value=none&gt;--------------------&lt;/option&gt;');";
    for(var i=1; i<=no_options; i++)
    {
     message += "<br>document.write('&lt;option value=&quot;" + eval('this.document.qiksearch.linkto' + i + '.value') "&quot;&gt;" + eval('this.document.qiksearch.option' + i + '.value') "&lt;/option&gt;');";
    }
   message += "<br>document.write('&lt;/select&gt;');";
   message += "<br>document.write('&lt;input type=&quot;button&quot; value=&quot;Go&quot; onclick=&quot;go()&quot;&gt;');";
   message += "<br>document.write('&lt;/form&gt;');";
   message += "<br>&lt;/script&gt;";
   message += "<br>&lt;!-- Download Qiksearch MenuGen from http://www.qiksearch.com/javascripts/menugen.htm --&gt;";
   DispWin.document.write(message);
}

function about()
{
 window.alert("Qiksearch MenuGen is a simple and handy tool using which you can create Javascript drop-down navigation Menus with ease. Qiksearch MenuGen, (c) 2002 Premshree Pillai. For updates visit Qiksearch at http://www.qiksearch.com. Mail me at [email protected]");
}

function help()
{
 window.alert('To use Qiksearch MenuGen, first select the number of Items you want in the menu. The default is 5. Then select the caption that will appear in the menu. Default is "Select". Then fill in the details of the Items. "Option" is the text that will appear when you pull the drop-down menu. "Link to" is the link to which that particular "Option" will point to. You may type your own link/URL or browse through to link to a local file. After you are done with all this, press the "Make My Code" Button. A new window will open, with the code you require. Press CTRL+A or right click and Select All, then copy the text and paste it wherever you require on your web page.');
}

</script>

</body>
</html>
Related examples in the same category
1.  Option selected index
2.  Auto Linked Option Listbox without button
3.  Change background
4.  Changing Select Element Content (two Combobox)
5.  Drop-down Redirect - No Submit button
6.  Drop-down Redirect - Submit
7.  Dropdown list (combobox) in a form
8.  dropdown list (combobox) in form 2
9.  Disable or enable an option
10.  Disable and enable a dropdown list (combobox)
11.  Return the name of the form that contains dropdown list (combobox)
12.  Number of options in the dropdown list(Combobox)
13.  Change the size of a dropdown list (ComboBox)
14.  Select multiple options in a dropdown list (option)
15.  Return the selected option as text in option
16.  Return the selected option as a number
17.  Change the option text
18.  Remove an option from a dropdown list (combobox)
19.  Methods and Properties of the Select Object
20.  Properties of the Option Object
21.   Using the Location object to change another frame's URL
22.  Using a Summary Form to Support Local Processing
23.  Navigating with a SELECT Object
24.  Using the selectedIndex Property
25.   Modifying OPTGROUP Element Labels
26.  Using the options[index].text Property
27.   Using the options[index].value Property
28.  Triggering a Color Change from a Pop-Up Menu
29.  Modifying SELECT Options
30.  Modifying SELECT Options (IE4+)
31.  Modifying SELECT Options (NN6+)
32.  Selecting an Option Using JavaScript
33.  Linked ComboBox (option) Country =- province
34.  ComboBox set value to TextField
35.  URL Option ComboBox
36.  Show Selected Option items








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.