摘要: 因为用Class获取元素时,有兼容性问题,需要分情况获取显示判断是否可以用getElementsByClassName,若是不介意用就要先获取全部的元素,在用正则判断function getClass(oParent,sClass){ if(oParent.getElementsByClass... 阅读全文
posted @ 2015-10-21 21:01 原以应 阅读(193) 评论(0) 推荐(0)
摘要: jsonp主要用于跨域进行数据的交互function json2url(json){ json.t=Math.random(); var arr=[]; for(var name in json) { arr.push(name+'='+json[name]);... 阅读全文
posted @ 2015-10-21 20:53 原以应 阅读(529) 评论(0) 推荐(0)
摘要: 使用:ajax({ url:'地址', data:{},//数据为json success:function(s){}, fail:function(){}});function ajax(url, fnSucc, fnFaild){ //1.创建Ajax对象 if(window... 阅读全文
posted @ 2015-10-21 20:51 原以应 阅读(196) 评论(0) 推荐(0)
摘要: 运动框架html js:window.onload=function(){ var oDiv=document.getElementById('div1'); oDiv.onclick=function(){ move(oDiv,{left:300}); };};使用:move()fu... 阅读全文
posted @ 2015-10-21 20:47 原以应 阅读(229) 评论(0) 推荐(0)