javascript 提交彈窗

來源:互聯網
上載者:User

標籤:UNC   round   hit   ever   put   doc   連接埠   ott   mode   

<!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8">    <title>Title</title>    <style>        .hide{            display: none;        }        .c1{            position: fixed;            left: 0;            top: 0;            right: 0;            bottom: 0;            background-color: black;            opacity: 0.6;            z-index: 9;        }                .c2{            width: 500px;            height: 400px;            background-color: white;            position: fixed;            left: 50%;            top: 50%;            margin-left: -250px;            margin-top: -200px;            z-index: 10;        } /*k    </style></head><body style="margin: 0;">    <div>        <input type="button" value="添加" onclick="ShowModel()">        <input type="button" value="全選" onclick="ChooseAll()">        <input type="button" value="取消" onclick="CancleAll()">        <input type="button" value="反選" onclick="Reverse()">        <table>            <thead>                <tr>                    <th>選擇</th>                    <th>主機名稱</th>                    <th>連接埠</th>                </tr>            </thead>            <tbody id="tb">                <tr>                    <td>                        <input type="checkbox"></td>                    <td>1.1.1.2</td>                    <td>190</td>                </tr>                <tr>                    <td><input type="checkbox"></td>                    <td>1.1.1.3</td>                    <td>192</td>                </tr>                <tr>                    <td><input type="checkbox"></td>                    <td>1.1.1.4</td>                    <td>193</td>                </tr>            </tbody>        </table>    </div>    <!--遮罩層開始-->    <div id=‘i1‘ class="c1 hide"></div>    <!--遮罩層結束-->        <!--彈出框開始-->    <div id=‘i2‘ class="c2 hide">        <p><input type="text"/></p>        <p><input type="text"/></p>        <p>            <input type="button" value="確定">            <input type="button" value="取消" onclick="HideModel()">        </p>    </div>    <!--彈出框結束-->    <script>        function ShowModel() {            document.getElementById(‘i1‘).classList.remove(‘hide‘);            document.getElementById(‘i2‘).classList.remove(‘hide‘);        }        function HideModel() {            document.getElementById(‘i1‘).classList.add(‘hide‘);            document.getElementById(‘i2‘).classList.add(‘hide‘);        }        function ChooseAll() {            var tbody = document.getElementById(‘tb‘); //擷取所有的tr            var tr_list = tbody.children;            for(var i=0; i<tr_list.length;i++){                //迴圈所有的tr, current_tr當前                var current_tr = tr_list[i];                var checkbox = current_tr.children[0].children[0] ;//checkbox的checked                checkbox.checked = true            }}            function CancleAll() {                var tbody = document.getElementById(‘tb‘); //擷取所有的tr                var tr_list = tbody.children;                for (var i = 0; i < tr_list.length; i++) {                    //迴圈所有的tr, current_tr當前                    var current_tr = tr_list[i];                    var checkbox = current_tr.children[0].children[0] ;//checkbox的checked                    checkbox.checked = false                }            }            function Reverse() {                var tbody = document.getElementById(‘tb‘); //擷取所有的tr                var tr_list = tbody.children;                for (var i = 0; i < tr_list.length; i++) {                    //迴圈所有的tr, current_tr當前                    var current_tr = tr_list[i];                    var checkbox = current_tr.children[0].children[0] ;//checkbox的checked                    if(checkbox.checked){                        checkbox.checked=false;                    }else{                        checkbox.checked=true;                    }                }            }    </script></body></html>

 

javascript 提交彈窗

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.