<select name="splace" onchange="eval(this.value)">
        <option value="javascript:show_loc('1');">Chennai</option>
        <option value="javascript:show_loc('2');">Coimbatore</option>

In the above code, in the option the value property is given as a javascript. Since in IE the onclick function doesn't work I've placed onchange in the select and then given the javascript in the option value. Now to save the value of option in the mysql table I need to provide the value as "Chennai" and "Coimbatore" in the value property, so that it can be saved in the table when i select them through mouse click or tab key. How can i make the javascript to work as well as give a value for the option to store in the table ? These thing must work in both the way i.e., when i use the mouse click and also when i use the tab key to select any of them.Pls reply me as soon as possible.Thanks :-)

remove the value attribute and make sure your select tag is named. Then when you submit the value will be what is selected for the select tag


<select name='selection'>
// the value of selection is what the user selects

if your trying to update the table on the onchange event then just do it this way

<select name='selection' onchange='update(this)'>

<script type='text/javascript'>
function update(e){
alert(e.value)// this will be the value on change if they select 1 then 1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.