[置顶] js实现下拉菜单提交表单后停留在选中option
2016-07-06 15:05
519 查看
<!DOCTYPE> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>成绩查询</title> <script src="./cjcx/js/jquery-1.10.1.min.js"></script> </head> <body> <form action="echo.php" method="get"> <select name="se1" id="se1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> <a id="wen">123<a> <input type="submit"/> </form> <script> $("#wen").click(function(){ alert(123); }) function GetRequest() { var url = location.search; //获取url中"?"符后的字串 var theRequest = new Object(); if (url.indexOf("?") != -1) { var str = url.substr(1); strs = str.split("&"); for(var i = 0; i < strs.length; i ++) { theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); } } return theRequest; } //alert(window.location.search.substr(1)); var se = GetRequest(se1)['se1']; var se = "'"+se+"'"; $("#se1 option[value="+se+"]").attr("selected","true"); </script> </body> </html>
相关文章推荐
- js敏感词过滤
- js中闭包的理解二
- 浅析highchart
- js中的return
- js中闭包的理解一
- 小代码 HTML 每个按钮控制一个DIV js实现
- js正则表达式的使用详解
- browser js
- js数组查找
- JavaScript高级程序设计——第5章:引用类型
- web.xml配置异常处理界面
- js 数值格式化函数
- JSON
- js 获取根目录 获取参数
- 格式化JSON输出
- webpack打包后bundle.js文件过大的问题
- JavaScript实现异步的4种方法
- 按钮特效 基于SVG和Segment.js的Loading加载
- js代码让iframe窗口全屏
- get不上去的,可能就需要用post 传 js ajax