Menu(Option) Generator : Option Select ComboBox « Form Control « JavaScript DHTML






Menu(Option) Generator

   
<!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 : premshree@hotmail.com            *
//* 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:premshree@hotmail.com"><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">&#169; 2002 <a href="mailto:premshree@hotmail.com"><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 premshree@hotmail.com");
}

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.Set select to multiple selected
2.Options in select
3.Option label
4.Option default Selected Example
5.Option selected Index Example
6.Option selected
7.Is Select a select-multiple
8.'index' Example
9.'value' Example
10.Add an option to select
11.'text' Example
12.Option selected index
13.Auto Linked Option Listbox without button
14.Triggering a Value Change from a Pop-Up Menu
15.Cycling through a Multiple-Selection List
16.Modifying optgroup Element Labels
17.Grouped selection control on change event
18.Change background
19.Changing Select Element Content (two Combobox)
20.Drop-down Redirect - No Submit button
21.Drop-down Redirect - Submit
22.Dropdown list (combobox) in a form
23.dropdown list (combobox) in form 2
24.Disable or enable an option
25.Disable and enable a dropdown list (combobox)
26.Return the name of the form that contains dropdown list (combobox)
27.Number of options in the dropdown list(Combobox)
28.Change the size of a dropdown list (ComboBox)
29.Select multiple options in a dropdown list (option)
30.Return the selected option as text in option
31.Return the selected option as a number
32.Change the option text
33.Remove an option from a dropdown list (combobox)
34.Methods and Properties of the Select Object
35.Properties of the Option Object
36. Using the Location object to change another frame's URL
37.Using a Summary Form to Support Local Processing
38.Navigating with a SELECT Object
39.Using the selectedIndex Property
40. Modifying OPTGROUP Element Labels
41.Using the options[index].text Property
42. Using the options[index].value Property
43.Triggering a Color Change from a Pop-Up Menu
44.Modifying SELECT Options
45.Modifying SELECT Options (IE4+)
46.Modifying SELECT Options (NN6+)
47.Selecting an Option Using JavaScript
48.Linked ComboBox (option) Country =- province
49.ComboBox set value to TextField
50.URL Option ComboBox
51.Show Selected Option items
52.Click button to navigate to selected url from form select control
53.Set the select control value
54.Add or remove options from select form control
55.Get changed selection from form select
56.Demonstrates select object used as a multi-line list box