PHP速学视频免费教程(入门到精通)
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
JQuery中select标签绑定的onchange事件然后弹出选择的值并实现跳转和传参
<script></script><script> $(document).ready(function(){ $('#mySelect').change(function(){ alert($(this).children('option:selected').val()); var p1=$(this).children('option:selected').val();//这就是selected的值 var p2=$('#param2').val();//获取本页面其他标签的值 window.location.href="xx.php?param1="+p1+"¶m2="+p2+"";//页面跳转并传参 }) }) </script><select><option>one</option> <option>two</option> <option>three</option></select><input>
jquery获取select选择的文本与值
获取select 选中的 text :
$("#ddlregtype").find("option:selected").text();
获取select选中的 value:
$("#ddlregtype ").val();
2.获取select选中的索引:
$("#ddlregtype ").get(0).selectedindex;
1、获取选中select的value和text,html代码如下:
<select><option>one</option> <option>two</option> <option>three</option></select>
则可通过以下script代码s来获取选中的value和text
$("#mySelect").val(); //获取选中记录的value值 $("#mySelect option:selected").text(); //获取选中记录的text值
var obj = document.getElementById("mySelect"); obj.add(new Option("4","4"));
3、删除所有选项option
var obj = document.getElementById("mySelect"); obj.options.length = 0;
4、删除选中选项option
var obj = document.getElementById("mySelect"); var index = obj.selectedIndex; obj.options.remove(index);
5、修改选中选项option
var obj = document.getElementById("mySelect"); var index = obj.selectedIndex; obj.options[index] = new Option("three",3); //更改对应的值 obj.options[index].selected = true; //保持选中状态
6、删除select
var obj = document.getElementById("mySelect"); obj.parentNode.removeChild(obj); //移除当前对象
7、select选择的响应事件
$("#mySelect").change(function(){ //添加所需要执行的操作代码 })
已抢7337个
抢已抢95475个
抢已抢14940个
抢已抢52729个
抢已抢195932个
抢已抢87512个
抢