How to get multiple select value both in javascript and php
2009-12-22 16:20
731 查看
For PHP, we must use test[] for the select name, but it doesn't work in javascript. document.form1.test is null.
So we should use document.getElementById('test[]') or document.form1['test[]']. On this way, we are able to get multiple select value in both PHP and JavaScript.
So we should use document.getElementById('test[]') or document.form1['test[]']. On this way, we are able to get multiple select value in both PHP and JavaScript.
<form name="form1"> <select name="test[]" multiple="multiple" onchange="alert(document.getElementById('test[]').value);"> <option value="one">one</option> <option value="two">two</option> <option value="three">three</option> <option value="four">four</option> <option value="five">five</option> </select> </form>
相关文章推荐
- [SharePoint]javascript client object model 获取lookup 类型的field的值,包括user类型(单人或者多人)的值。how to get the multiple user type/lookup type field value by Javascript client object model
- How to get URL and QueryString value in an ASP.NET page
- how to select data in multiple datatables after using join,group by and order by in Linq
- How To determine DDIC Check Table, Domain and Get Table Field Text Data For Value?
- How to Compare two layer’s object: Get AOT objects both modified in USR & SL1 layer
- How to get download games hack cheat tools to get coins ,Diamonds and money in games
- How to Get First and Last Day of a Week in SQL Server
- How to get the object type in javascript:
- how to add Javascript and CSS in page layout with sharepoint 2013
- use noscript html tag when user disable the javascript in browser, guide user how to enable the js in different browser and retu
- how to focus to a div both in firefox and IE
- Get the content of an Iframe in Javascript – crossbrowser solution for both IE and Firefox
- how to get soul shields in blade and soul
- How To Create Multiple Folders And Sub-Folders In One Go
- How to Drag and Drop in JavaScript
- 【摘自Devx】How to pass parameters to Thread in Windows Forms -- and get results back
- How to get and set the drawing order of layers in globe(获取并设置Globe图层的叠加次序:)
- How to install LAMP (Apache, PHP and MySQL in Linux) using Yum
- How To Get Log, Trace Files In OA Framework Pages And Concurrent Request Programs (文档 ID 290614.1)
- I was eager to get my paddles wet and see how this kayak performed in the water.