zoukankan      html  css  js  c++  java
  • js select事件

    <!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" />
    <script src="jquery/jquery.js"> </script>

    <script type="text/javascript">
    function eventHandler() {
    var obj = document.getElementById('selectOption');
    var index = obj.selectedIndex;

    alert(obj.options[index].value);
    $("#testDiv").append("Content:<br>");
    $("#testDiv").removeAttr("style");

    $("#testDiv").attr("style", " 1200px; height: 440px;border:1px solid blue; margin:auto;" );
    }

    </script>
    </head>

    <body>
    <div id="testDiv"></div>
    <select id='selectOption' onchange="eventHandler()">
    <option value="ying" selected="selected">Ying</option>
    <option value="saab">Saab</option>
    <option value="opel">Opel</option>
    <option value="audi">Audi</option>
    </select>

    <script type="text/javascript">

    </script>
    </body>
    </html>

  • 相关阅读:
    [BZOJ3257]树的难题
    [BZOJ4987]Tree
    [NOI2015][洛谷P2150]寿司晚宴
    P2221 [HAOI2012]高速公路
    BUG全集(我遇到的)
    NOIP2018游记
    BZOJ1103
    Google Chrome 优化
    特殊空格
    Ant Design Vue 使用
  • 原文地址:https://www.cnblogs.com/diyingyun/p/2803213.html
Copyright © 2011-2022 走看看