zoukankan      html  css  js  c++  java
  • select单选

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <head>
     4     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
     5     <title>select</title>
     6     <script type="text/javascript" src="eventutil.js"></script>
     7 </head>
     8 <body>
     9     <select name="location" id="selLocation">
    10         <option value="0">请选择...</option>
    11         <option value="Sunnyvalue, CA">Sunnyvalue</option>
    12         <option value="Los Angeles, CA">Los Angeles</option>
    13         <option value="Mountain View, CA">Mountaion View</option>
    14         <option value="">China</option>
    15         <option>Australia</option>
    16     </select>
    17     <script type="text/javascript" src="test04.js"></script>
    18 </body>
    19 </html>
    1 var selectbox = document.getElementById("selLocation");
    2 EventUtil.addHandler(selectbox, "change", function() {
    3     var selectedIndex = selectbox.selectedIndex;
    4     var selectedOption = selectbox.options[selectedIndex];
    5     console.log("Selected index: " + selectedIndex + "\nSelected text: " + selectedOption.text + "\nSelected value: " + selectedOption.value);
    6 });
  • 相关阅读:
    mysql 基础sql语句
    mysql存储引擎概述
    docker命令总结
    python链接postgresql
    Log4.net示例
    postgresql 使用游标笔记
    npm常用命令
    Nginx命令
    Ubuntu命令总结
    NHibernate总结
  • 原文地址:https://www.cnblogs.com/qzsonline/p/2534936.html
Copyright © 2011-2022 走看看