zoukankan      html  css  js  c++  java
  • JS 改变input 输入框样式

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>Change.html</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        
        <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
      <script language="javascript">
         function test4(event) {
    	   if(event.value == "11") {
    	      //?Ϧdiv1
    	      //var div1 = document.getElementById('div1');
    		  var div1 = document.getElementById("div1");
    		  var div2 = document.getElementById("div2");
    	      div1.style.backgroundColor="black";
    		  div2.disabled = true;
    		  div2.readOnly = true;
    	   }
    	   if(event.value == "22") {
    	      //?Ϧdiv1
    	      //var div1 = document.getElementById('div1');
    		  var div1 = document.getElementById("div1");
    		  var div2 = document.getElementById("div2");
    	      div1.style.backgroundColor="red";
    		   div2.disabled = false;
    		   div2.readOnly = false;
    	   }
    	 }
      </script>
    </head>
    <body>
      <!--<div id="div1" style="400px; height:300px; background-color:red;">div1</div>-->
      <div id="div1" style="400px; height:300px; background-color:red;">div1</div>
      <input type="text" id="div2" value=""/>
      <input type="button" value="11" onclick="test4(this)"/>
      <input type="button" value="22" onclick="test4(this)"/>
    
      </body>
    </html>
    

     不配图,复制代码一运行就能知道

  • 相关阅读:
    GitLab 介绍
    git 标签
    git 分支
    git 仓库 撤销提交 git reset and 查看本地历史操作 git reflog
    git 仓库 回退功能 git checkout
    python 并发编程 多进程 练习题
    git 命令 查看历史提交 git log
    git 命令 git diff 查看 Git 区域文件的具体改动
    POJ 2608
    POJ 2610
  • 原文地址:https://www.cnblogs.com/sunxun/p/4325176.html
Copyright © 2011-2022 走看看