标签:今天 代码 ges button onclick doctype 技术分享 content rip
<!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",200); 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("width"); } </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>
<!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>
标签:今天 代码 ges button onclick doctype 技术分享 content rip
原文地址:http://www.cnblogs.com/cxx8181602/p/6168355.html