Javascript
那年夏天KEEP
唯一幸运的就是喜欢这个行业
展开
-
深入理解Javascript之this关键字
本文地址: http://www.laruence.com/2009/09/08/1076.htmlJavascript是一种很灵活的语言, 而This关键字又是灵活中的灵活, 但是因为它的灵活, 也注定了它的难用.以前我用this的时候, 都会觉得不踏实, 老是担心它不知道怎么地就会指到另外的什么地方.其实, 这都是因为, 我们对它的不了解.刚好最近再给百度学院做《Javascript高级-作用域转载 2015-10-06 00:32:09 · 372 阅读 · 0 评论 -
JS报错:Permission denied to access property 'document'---document.domain - JavaScript的同源策略问题
错误原因是因为父窗口与子窗口的域名不同,即便同一站点下,也需要写全引用地址:如同是xxx.com下的页面<iframe id="iframe_xxxx" name="iframe_xxxx" src ="/sub.html" frameborder="0" height="300" width="1000"></iframe>与<iframe id="iframe_xxxx" name="if转载 2015-11-16 15:47:01 · 844 阅读 · 0 评论 -
$.ajax()方法详解
jquery中的ajax方法参数1.url:要求为String类型的参数,(默认为当前页地址)发送请求的地址。2.type:要求为String类型的参数,请求方式(post或get)默认为get。注意其他http请求方法,例如put和delete也可以使用,但仅部分浏览器支持。3.timeout:要求为Number类型的参数,设置请求超时时间(毫秒)。此设置将覆盖$.ajaxSetup()转载 2015-10-27 23:30:51 · 259 阅读 · 0 评论 -
js数组的操作
1、数组的创建var arrayObj = new Array(); //创建一个数组var arrayObj = new Array([size]); //创建一个数组并指定长度,注意不是上限,是长度var arrayObj = new Array([element0[, element1[, ...[, elementN]]]]); //创建一个数组并赋值 要说明的是,虽然第二种方法创建转载 2015-11-12 20:23:40 · 413 阅读 · 0 评论 -
弹出层,遮罩层的实现
函数实现遮罩层、弹出框 //锁定背景屏幕 function lockScreen() { var clientH = document.body.offsetHeight; //body高度 var clientW = document.body.offsetWidth; //body宽度 var docH = document.body.sc转载 2015-10-28 00:39:23 · 397 阅读 · 0 评论 -
$.ajax()方法详解
jquery中的ajax方法参数1.url:要求为String类型的参数,(默认为当前页地址)发送请求的地址。2.type:要求为String类型的参数,请求方式(post或get)默认为get。注意其他http请求方法,例如put和delete也可以使用,但仅部分浏览器支持。3.timeout:要求为Number类型的参数,设置请求超时时间(毫秒)。此设置将覆盖$.ajaxSetup()转载 2015-10-27 23:31:14 · 342 阅读 · 0 评论 -
jQuery ajax - serialize() 方法
实例输出序列化表单值的结果:$("button").click(function(){ $("div").text($("form").serialize());});亲自试一试定义和用法serialize() 方法通过序列化表单值,创建 URL 编码文本字符串。您可以选择一个或多个表单元素(比如 input 及/或 文本框),或者 form 元素本身。序列化的值可在生成 AJA原创 2015-10-12 14:46:23 · 343 阅读 · 0 评论 -
JS setInterval()、 setInterval()与 clearInterval() 方法的使用
HTML DOM setInterval()、clearInterval() 方法<html><head> <title>标题</title> <script src="../js/clock.js" mce_src="js/clock.js" language="JavaScript"> </script></head><body> <div id="clo转载 2015-10-28 00:19:23 · 1641 阅读 · 0 评论 -
ajax+php无刷新文件上传(ajaxuploadfile)
文件上传的表单格式<form id="uploadform" enctype="multipart/form-data" name="uploadform" method="post" > <input id="fileToUpload" type="file" name="fileToUpload" class="uploadinput" > <input id=转载 2015-11-08 23:55:02 · 930 阅读 · 0 评论 -
window.location.reload;刷新\indexOf()定义和用法\window.location.href
使用window.location.reload;刷新时,如果提交数据的动作,则会出现讨厌的对话框! 解决此问题,应该这样写: window.location.href=window.location.href; window.location.reload; 同理,如果是刷新父窗口,应该这样写: window.opener.location.href=window.opener.locatio转载 2015-11-08 13:27:30 · 5311 阅读 · 0 评论 -
jQuery unbind 删除绑定事件 / 移除标签方法
jQuery unbind 删除绑定事件 unbind([type],[data]) 是 bind()的反向操作,从每一个匹配的元素中删除绑定的事件。如果没有参数,则删除所有绑定的事件。你可以将你用bind()注册的自定义事件取消绑定。如果提供了事件类型作为参数,则只删除该类型的绑定事件。如果把在绑定时传递的处理函数作为第二个参数,则只有这个特定的事件处理函数会被删除。返回值 :原创 2015-10-20 12:48:53 · 5437 阅读 · 0 评论 -
js的cookie扩展
/*! * jQuery Cookie Plugin v1.3 * https://github.com/carhartl/jquery-cookie * * Copyright 2011, Klaus Hartl * Dual licensed under the MIT or GPL Version 2 licenses. * http://www.opensource.org/li原创 2015-10-05 23:36:01 · 329 阅读 · 0 评论 -
设置首页\收藏本站\返回头部
1.设置首页function SetHome(obj,url){ try{ obj.style.behavior='url(#default#homepage)'; obj.setHomePage(url); }catch(e){ if(window.netscape){ try{ netscape.security.PrivilegeMan转载 2015-11-20 02:07:29 · 349 阅读 · 0 评论