zoukankan      html  css  js  c++  java
  • 随笔

    <style>
    #div1{
    100px;
    height: 100px;
    background-color: red;
    }
    </style>
    </head>

    <body>
    <div id="divid"></div>
    <div class="divclass"></div>
    <div class="divclass"></div>
    <input name="inputname" type="text" />
    <input type="button" onclick="btn()" />
    <div id="test"></div>
    <!--<div id="czsx" style=" 200px;height: 200px; border: 1px solid black;">
    123
    </div>-->
    <table id="czsx">
    <tr>
    <td>123</td>
    </tr>
    </table>

    <input id="btn-cz" type="button" value="提交" />
    <div id="div1"></div>
    <script>
    // var count = 0;
    // for(var i = 3; i < 1001; i++) {
    // var status = 0;
    // for(var j=2;j<i;j++){
    // if(i%j ==0)
    // {
    // status = 1;
    // break;
    // }
    // }
    // if(status ==0)
    // {
    // document.write(i + "<br>");
    // count++;
    // }
    // }
    // alert(count);

    // document.alert("弹窗");
    // window.alert("弹窗");
    // 1.id选择器
    document.getElementById("divid").innerHTML = "啦啦啦啦啦";
    // 2.class选择器
    var divc = document.getElementsByClassName("divclass");
    // alert(typeof(divc));
    divc[0].innerHTML = "嘿嘿嘿嘿";
    divc[1].innerHTML = "哈哈哈哈";
    for(var i = 0 ;i<divc.length;i++)
    {
    divc[i].innerHTML += "略略略略";
    }
    // 3.标签选择器
    document.getElementsByTagName("div")[0].innerHTML += "耶耶耶耶";
    // 4.name选择器
    document.getElementsByName("inputname")[0].value = "哒哒哒嗒";
    var input = document.getElementsByName("inputname")[0].value;
    // alert(input);

    function btn(){
    var div1 = document.getElementById("divid");
    div1.innerHTML += "oooooooo";
    }

    // document.getElementById("test").innerHTML = "<b>加粗</b>";
    document.getElementById("test").innerText = "<b>加粗</b>";

    document.getElementById("czsx").setAttribute("bgcolor","red");

    document.getElementById("btn-cz").setAttribute("disabled","disabled");
    document.getElementById("btn-cz").removeAttribute("disabled");
    var btn_cz = document.getElementById("btn-cz").getAttribute("value");
    // alert(btn_cz);
    var div1 = document.getElementById("div1");
    // div1.setAttribute("style"," 200px;height:200px;background-color: red;");

    // div1.style.width = "100px";
    // div1.style.height = "100px";
    // div1.style.backgroundColor = "red";

    alert(div1.style.width);
    </script>

    </body>

  • 相关阅读:
    Shell 脚本基本操作练习
    Unix 环境高级编程---线程创建、同步、
    ubuntu 安装ssh-server时出现错误:openssh-server: Depends: openssh-client (= 1:5.3p1-3ubuntu3) but 1:5.3p1-3ubuntu4 is to be installed
    python set 集合
    python 深浅拷贝
    用户权限管理
    vim 编辑器的使用
    linux系统初体验
    平滑升级nginx
    在windows下如何使用密钥对远程登录服务器?
  • 原文地址:https://www.cnblogs.com/gyzown/p/6606103.html
Copyright © 2011-2022 走看看