• 图片修改,获取,删除和按钮的全选,取消,反选


     图片修改,获取,删除deom

    <!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" xml:lang="zh-cn">
    <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <title>网页标题</title>
    <meta name="keywords" content="关键字列表" />
    <meta name="description" content="网页描述" />
    <link rel="stylesheet" type="text/css" href="" />
    <style type="text/css"></style>
    <script type="text/javascript">
    //修改获取其他图片
    function setAtt(){
      var imgObj=document.getElementById("getImg");
      imgObj.setAttribute("width",500);
      //注意: 图片地址需要修改
      imgObj.setAttribute("src","images/2.jpg");
    }

    //获取图片名称
    function getAtt(){
      var imgObj=document.getElementById("getImg");
      alert(imgObj.getAttribute("src"));
    }

    //删除图片地址
    function removeAtt(){
      var imgObj=document.getElementById("getImg");
      imgObj.removeAttribute("src");
    }
    </script>
    </head>

    <body>
    <!--注意: 图片地址需要修改 -->
    <img src="images/1.jpg" id="getImg">
    <input type="button" value="修改图片" onclick="setAtt()"/>
    <input type="button" value="获取图片地址" onclick="getAtt()"/>
    <input type="button" value="删除图片" onclick="removeAtt()"/>
    </body>
    </html>

    按钮的全选,取消,反选demo

    <!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" xml:lang="zh-cn">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        <title>网页标题</title>
        <meta name="keywords" content="关键字列表" />
        <meta name="description" content="网页描述" />
        <link rel="stylesheet" type="text/css" href="" />
        <style type="text/css"></style>
        <script type="text/javascript">
        window.onload=function(){
            var qx_obj=document.getElementById("qxobj");
            var quxiao_obj=document.getElementById("quxiaoobj");
            var fx_obj=document.getElementById("fxobj");
            var ah_obj=document.getElementsByName("suju");
            //全选按钮
            qx_obj.onclick=function(){
                
                for(var i=0;i<ah_obj.length;i++){
                    ah_obj[i].checked=true;
                }
            }
            
            // 取消按钮
            quxiao_obj.onclick=function(){
                
                for(var i=0;i<ah_obj.length;i++){
                    ah_obj[i].checked=false;
                }
            }
            //反选选代码
              fx_obj.onclick=function(){
                
                for(var i=0;i<ah_obj.length;i++){
                    if(ah_obj[i].checked==true)
                    {
                        ah_obj[i].checked=false;
                    }else{
                        ah_obj[i].checked=true;
                    }
                }
            }
        }
    
        </script>
    </head>
    <body>
    爱好1:<input type="checkbox" name="suju"/></br>
    爱好2:<input type="checkbox" name="suju"/></br>
    爱好3:<input type="checkbox" name="suju"/></br>
    爱好4:<input type="checkbox" name="suju"/></br>
    爱好5:<input type="checkbox" name="suju"/></br>
    爱好6:<input type="checkbox" name="suju"/></br>
    爱好7:<input type="checkbox" name="suju"/></br>
    爱好8:<input type="checkbox" name="suju"/></br>
    <input type="button" value="全选" id="qxobj"/>
    <input type="button" value="取消" id="quxiaoobj"/>
    <input type="button" value="反选" id="fxobj"/>
    
    </body>
    </html>

  • 相关阅读:
    Java Class/Method
    Data Types in Java
    Java overview && JVM
    Interface Vs. Abstract Class
    【javascript】Object三种定义方式
    【C#】导出Excel
    【javascript】简单原型链、借用构造函数
    Mysql表编码查看修改
    asp.net的mvc?
    连表
  • 原文地址:https://www.cnblogs.com/cxx8181602/p/6168355.html
Copyright © 2020-2023  润新知