07 2019 档案

自定义属性的添加
摘要:<ul id="uu"> <li>aa</li> <li>ss</li> <li>zz</li> <li>xx</li> </ul> <script> var list=document.getElementById("uu").getElementByTagname("li"); for(var 阅读全文

posted @ 2019-07-31 11:40 大橙!! 阅读(172) 评论(0) 推荐(0)

innerText Textcontent浏览器兼容代码
摘要:设置标签中的文本内容,应该使用textcontent属性,谷歌,火狐支持 IE8不支持 设置标签中的文本内容,应该使用textcontent属性,谷歌,火狐,IE8都支持 如果这个属性在浏览器中都不支持,那么这个属性的类型是“undefined” 判断这个属性的类型是不是“undefined”,就知 阅读全文

posted @ 2019-07-26 15:50 大橙!! 阅读(145) 评论(0) 推荐(0)

获取间的内容
摘要:<input type="button" value=" 按钮" id="btn"/> <p>aaaacc</p> document.getElementById("btn").onclick=function(){ console.log(document.getElementsByTagName 阅读全文

posted @ 2019-07-25 14:50 大橙!! 阅读(92) 评论(0) 推荐(0)

密码长度为6-10的判断
摘要:<input type="text" value="" id="mm"/> document.getElementById("mm").onblur=function(){ if(mm.value.length>=6&&mm.value.length<=10){ this.style.backgro 阅读全文

posted @ 2019-07-25 11:29 大橙!! 阅读(283) 评论(0) 推荐(0)

模拟输入框
摘要:#txt{ color: gray; } #txt{ color: gray; } #txt{ color: gray; } <input type="text" value="请输入内容" id="txt"/> document.getElementById("txt").onfocus=func 阅读全文

posted @ 2019-07-25 10:09 大橙!! 阅读(107) 评论(0) 推荐(0)

排他功能
摘要:<body> <input type="button" value="Hi" /> <input type="button" value="Hi" /> <input type="button" value="Hi" /> <input type="button" value="Hi" /> <in 阅读全文

posted @ 2019-07-23 13:55 大橙!! 阅读(120) 评论(0) 推荐(0)

获取元素
摘要:根据id属性的值获取元素,返回来的是一个元素对象 document.getElementById("id属性的值"); 根据标签名字获区元素,返回来的是一个伪数组,里面保存了多个DOM对象 document.getElementsByTagName("标签的名字"); 以下有的浏览器不支持 (h5 阅读全文

posted @ 2019-07-23 13:18 大橙!! 阅读(115) 评论(0) 推荐(0)

js中获取当前url路径
摘要:<script> $(function(){ // 返回 web 主机的域名,如:http://127.0.0.1:8080/testdemo/test.html?id=1&name=test var url = window.location.href; // 返回当前页面的路径和文件名,如:/t 阅读全文

posted @ 2019-07-13 11:16 大橙!! 阅读(39306) 评论(0) 推荐(7)

导航