SQL PHP HTML ASP JavaScript articles and free scripts to download
 

JavaScript drop down listbox

List box or drop down list box is very common in forms used in web pages. We can give option to visitor to select from a list by clicking and selecting one ( or more ) out of a pre defined list. So the advantage is visitor can't give any choice of its own.

You can read more on basics of drop down list box with style property in our html section.

We can add many JavaScript controls to list boxes by various properties and methods. We will develop some scripts which use these controls and give desired output. We will start with some basic script and then develop complex ones.

Listbox Validation

Submit the form if listbox is selected by user. Otherwise display an alert box.

Listbox disable

Enable or disable listbox based on input selection by using in a form.

onChange event of ListBox

Triggering JavaScript function by using onChange event of a drop down listbox.

Adding option to List box

Dynamically we can add options to our list box through JavaScript.

Removing Options

We can also remove options from a drop down list box

Moving Options

Moving or shifting options from one list box to another list box

Dependant list box

The options of second list box will change based on the selection of first list box by user.

Dependant list box with data

We can populate list box by using data from a MySQL table.

Copy Listbox data along with other form data

While copying a set of form data to other fields we can pass the list box data also.

Found anything wrong or wants to improve the code by adding more features? Post your short comment here or use the Forum



Further readings
Disabling the submit button till all the elements of the form are validated
getElementById to access form elements with event handlers
Javascript Form Validation
Period button Validation of a form
How to limit number of checkboxes allowed to be clicked inside a form
Checkbox Validation of a form
Displaying checked value of a check box array
disabling checkbox by button click
disabling Period button by a checkbox
Enable or disable of a text box by a checkbox
All Checking & Un checking in a group of checkboxes by single button
Adding options to a drop down list box
Removing options from a drop down list box
Moving options from one drop down list box to other
Dynamic population of second list box based on value of first list box
srinivas29-03-2010
It is very good site for learners, who wants work with the php,asp etc.., can u provide more content to learners
Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

Join Our Email List
Email:  
For Email Newsletters you can trust
Form validation
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2013 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer