获取select value值 onchange事件触发
2018-03-01 14:30
429 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;"> <title>测试</title> <style> *{margin: 0;padding: 0;} .shangjia{width: 90%;height: 70px;border-top: 1px solid #bdbcbc;border-bottom: 1px solid #bdbcbc; margin: 10px auto;} .shangjia span{font-size: 25px;line-height: 70px;color: #060606;font-family: 微软雅黑;display: inline-block;float: left; letter-spacing: 1px;} .num{display: inline-block;width: 15%;height: 55px;font-size: 25px;float: right;padding-top: 15px;} .num select{ font-size: 25px; border: none; outline: none; width: 100%; display: inline; float: right; } .guke{width: 90%;height: 70px;border-top: 1px solid #bdbcbc; border-bottom: 1px solid #bdbcbc; margin: 10px auto;} .guke span{font-size: 25px;line-height: 70px;color: #060606;display: inline-block;float: left;letter-spacing: 1px;} </style> </head> <body> <div class="shangjia"> <span>商家营销比例(%)</span> <div class="num"> <select id="xuanze" onchange="changeValue();"> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> <option value="25">25</option> <option value="30">30</option> <option value="35">35</option> <option value="40">40</option> </select> </div> </div> <div class="guke"> <span>平台补币</span> <div class="num_right" id="num_right"> 25 </div> </div> <script type="text/javascript"> function changeValue(){ var obj = document.getElementById('xuanze'); //定位id var index = obj.selectedIndex; // 选中索引 var value = obj.options[index].value; // 选中值 var n1 = Number(value); var newdiv = document.getElementById("num_right"); newdiv.innerHTML = n1*2.5; }; </script> </div> </body> </html>
相关文章推荐
- 如何获取select中的value、text、index相关值 && 如何获取单选框中radio值 && 触发事件 && radio 默认选中
- Select下拉框onchange事件获取option的value值
- Select下拉框onchange事件获取option的value值
- Select下拉框onchange事件获取option的value值 js写法
- Select下拉框onchange事件获取option的value值
- Select的OnChange()事件中获取选中的值
- JS改变input的value值不触发onchange事件解决方案
- select重复选择同一项,还可以触发onchange事件
- 修改select标签为可输入内容的input标签,同时在首次点击第一个下拉框时也会触发onchange事件
- JS改变input的value值不触发onchange事件解决方案 (转)
- js代码赋值触发select控件的onchange事件
- Select下拉框onchange事件获取option的value值
- JS改变input的value值不触发onchange事件解决方案
- JS改变input的value值不触发onchange事件解决方案
- Select下拉框动态获取数据,并触发事件
- Select中使用js动态修改了Option时如何触发onchange事件
- Select下拉框onchange事件获取option的value值
- 获取select中option的value值并触发隐藏显示div效果
- Javascript获取select下拉框选中的的值,select中指定option选中触发事件
- Select下拉框onchange事件获取option的value值