Search

Sponser

Sunday, 21 October 2012

Inserting a drop-down list




A drop-down menu is used in a form, and allows a site visitor to select an item from a list.
To add a drop-down list:
1. Select Insert > Form > Drop-down List...

2. Click Add.

3. In the Add Option dialog box, enter Text and Value and click OK.
  • Text: Enter the text of the item that will appear in the menu when viewed in a browser.
  • Value: Enter the value that will be sent to the web server when a site visitor selects the item.
You can write the option values to meet your needs, i.e., type the page's URL using a relative path in the Value box (e.g. page2.html).
4. If you wish to attach an action, select Insert > Form > Form. Double click the main form, enter action in the Action box to apply any actions. Then make thedrop-down list is belonged to the form.
     Note: You will need an html code to make the drop down list to work. Select Html Code or Script code from the Insert menu, paste the code below into the Html Editor window:



<script language="javascript">
function gotoUrl(url) {
if (url == "")
return;
location.href = url;
}
function newWin(url) {
// url of this function should have the format: "target,URL".
if (url == "")
return;
window.open(url.substring(url.indexOf(",") + 1, url.length),
url.substring(0, url.indexOf(",")));
}
function fnOnChange(){
gotoUrl(selector.options[selector.selectedIndex].value);
return true;
}
var selector = (document.getElementById)? document.getElementsByName("formselect1")[0] : document.all.formselect1;
selector.onchange=fnOnChange;
</script>

Recommeded Links