摘要: var ua=navigator.userAgent;if(ua.indexOf("MicroMessenger">=0)){//微信打开}else if(ua.indexOf("NewsApp")>=0){//网易新闻客户端}else{//其他} 阅读全文
posted @ 2016-03-11 15:42 duowen 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1.获取元素: var box=document.getElementById("box");2.改变元素内容: box.innerHTML("我要变内容"); 3.改变内容样式: box.style.color="#c00"; box.style.backgroundColor="#ccc"; b 阅读全文
posted @ 2016-03-11 15:00 duowen 阅读(97) 评论(0) 推荐(0) 编辑
摘要: preventDefault():终止事件的后续默认操作。 stopPropagation() :阻止当前事件的冒泡行为。 var a=document.getElementById('a'); a.onclick=function(e){ e.preventDefault(); //a链接不会跳转 阅读全文
posted @ 2016-03-11 11:37 duowen 阅读(100) 评论(0) 推荐(0) 编辑
摘要: //获取地址栏 参数function getUrlK(key){ var arr1 = window.location.toString().split('?'); for (var i=1; i<arr1.length; i++) { var arr2 = arr1[i].split('='); 阅读全文
posted @ 2016-03-10 13:51 duowen 阅读(70) 评论(0) 推荐(0) 编辑