摘要: 例子: html代码: css代码: json数据: 1、使用原生ajax方法 2、使用jquery $.ajax方法: 3、引入模板并用ajax方法使用: 浏览器效果: 阅读全文
posted @ 2017-11-27 17:29 asimpleday 阅读(454) 评论(0) 推荐(0) 编辑
摘要: 同源策略 同源策略阻止从一个域上加载的脚本获取或操作另一个域上的文档属性。也就是说,受到请求的 URL 的域必须与当前 Web 页面的域相同。 什么是jsonp? JSONP(JSON with Padding)是一个非官方的协议,它允许在服务器端集成Script tags返回至客户端,通过java 阅读全文
posted @ 2017-11-27 15:18 asimpleday 阅读(155) 评论(0) 推荐(0) 编辑
摘要: jq的ajax方法 原生的ajax方法 get 原生的ajax方法 post 阅读全文
posted @ 2017-11-27 11:47 asimpleday 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 1 123 2 3 function removeClass(element,classNa){ 4 var arr=new Array(); 5 var classArr=element.className.split(" "); 6 element.className=""; 7 for(var i=0;... 阅读全文
posted @ 2017-10-27 14:13 asimpleday 阅读(152) 评论(0) 推荐(0) 编辑
摘要: function client(){ if(window.innerHeight !== undefined){ return { "width": window.innerWidth, "height": window.innerHeight } }else if(document.compatMo... 阅读全文
posted @ 2017-10-20 16:59 asimpleday 阅读(721) 评论(0) 推荐(0) 编辑
摘要: scroll().top 代表scrollTop scroll().left 代表scrollLeft 或者: 阅读全文
posted @ 2017-10-20 15:44 asimpleday 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 1、获得事件对象 2、事件的目标 3、阻止事件冒泡 4、取消默认行为 5、获得页面滚动的高度 6、pageX、pageY (pageX页面坐标位置、clienetX是浏览器可视区域位置、screenX是屏幕坐标位置) 阅读全文
posted @ 2017-10-18 09:39 asimpleday 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 单个属性: 多个属性: 阅读全文
posted @ 2017-10-17 14:42 asimpleday 阅读(120) 评论(0) 推荐(0) 编辑
摘要: var arr=["a","b","c","a","a","b","d"]; function fn(array){ var newArr=[]; for(var i=0;i<array.length;i++){ var bool=true; for(var j=0;j<newArr.length;j++){... 阅读全文
posted @ 2017-09-06 12:26 asimpleday 阅读(190) 评论(0) 推荐(0) 编辑
摘要: var arr=[10,50,30,40,60,70,100,20,30]; for(var i=0;iarr[j+1]){ var temp=arr[j]; arr[j]=arr[j+1]; arr[j+1]=temp; bool=false; ... 阅读全文
posted @ 2017-08-31 09:25 asimpleday 阅读(125) 评论(0) 推荐(0) 编辑