读写cookie的方法
摘要:AppTui.Cookie = { getCookie: function(name) { var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if (arr != null) { return window.unescape(arr[2]); } return null; }, setCookie:function(name,value,expires,path,domain,secure){ var expDays = expires*24*60*60*
阅读全文
posted @
2011-12-11 16:22
袁晓平
阅读(171)
推荐(0)
获取页面宽高的一些代码
摘要:获取页面宽度 page_widthdocument.body.scrollWidth || document.documentElement.scrollWidth || 0;获得页面高度page_heightdocument.body.scrollHeight || document.documentElement.scrollHeight || 0;获取页面body宽度body_width document.body.clientWidth || document.documentElement.clientWidth || 0;获取页面body高度body_topwindow.pageY
阅读全文
posted @
2011-12-11 16:18
袁晓平
阅读(221)
推荐(0)
根据dom对象或其id获取对象位置的代码
摘要:function getPostionByDom(element) { var el; var ua = navigator.userAgent.toLowerCase(); var isOpera = (ua.indexOf('opera') != -1); var isIE = (ua.indexOf('msie') != -1 && !isOpera); // not opera spoof if (typeof element == 'object'){ el = element; } else{ el = documen
阅读全文
posted @
2011-12-11 15:28
袁晓平
阅读(219)
推荐(0)
识别移动设备脚本
摘要:var QVPL= {};var pl = navigator.platform.toLowerCase(); var ipad = pl.match(/ipad/); if (ipad) { QVPL._clientPlatform = "ipad"; return true; } var iphone = pl.match(/iphone/);if (iphone) { QVPL._clientPlatform = "iphone"; return true; } var ipod = pl.match(/ipod/); ...
阅读全文
posted @
2011-12-11 14:28
袁晓平
阅读(1155)
推荐(0)
frame页面地址转向跨域解决方法
摘要:mainFrame.htm下有两个iframe,左边是left.aspx,frame名是leftFrame,右边名是是mainFrameleft.aspx包含了很多的连接,linka和linkc连到oa.shrcoa.gov.cn域名下的一个页面,linkb连到contact.shrcoa.gov.cn域名下的一个页面,left.aspx有脚本实现跳转,parent.frames['mainFrame'].frameElement.src = '....';,当点击linka后再点击linkc没有问题,在同一个域里,但点击linka后再点击linkb再点击lin
阅读全文
posted @
2011-11-24 13:18
袁晓平
阅读(503)
推荐(0)
自己写的常用jquery扩展函数
摘要:;(function($) {$.request = {};$.validate = {};$.common = {};$.extend(jQuery.request, {queryString: function (name) { var url = document.URL; var arr = url.split('?'); if (arr.length < 2) { return '...
阅读全文
posted @
2010-07-02 16:58
袁晓平
阅读(585)
推荐(0)
按索引和键值删除数组元素的js函数
摘要:Array.prototype.removeIndex = function(i) { if (isNaN(i) || i > this.length) return false; this.splice(i,1); } Array.prototype.remove = function(key) { for (var i = 0; i < this.length; ++i)...
阅读全文
posted @
2009-12-08 13:10
袁晓平
阅读(755)
推荐(0)
判断两个对象是否相等的js函数
摘要:如果两个对象属性在初始化时出现的顺序不一样 但数目及值一样,最终比较结果也是true支持每个属性又是其他类型,如对象、数组、数字、字符串 function equal(objA, objB){ if (typeof arguments[0] != typeof arguments[1]) return false; //数组 if (arguments[0] instanceof Array) ...
阅读全文
posted @
2009-12-08 12:51
袁晓平
阅读(13475)
推荐(1)
iframe自适应js代码段
摘要:在主页面:<iframe id="infoframe" width="100%" onload="this.height=infoframe.document.body.scrollHeight" frameborder="0" src=ComputerStaticInfo.aspx></iframe>在iframe所指页面(ComputerStaticInfo.aspx)...
阅读全文
posted @
2009-12-07 16:59
袁晓平
阅读(207)
推荐(0)
JS分级下拉列表框
摘要:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE> New Document </TITLE><META NAME="Generator" CONTENT="EditPlus"><META NAME="Auth...
阅读全文
posted @
2009-09-27 11:16
袁晓平
阅读(667)
推荐(0)
访问cookie的js函数
摘要:function setCookie(c_name, value, expiredays){ var exdate = new Date(); exdate.setDate(exdate.getDate() + expiredays); document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";exp...
阅读全文
posted @
2009-08-26 11:21
袁晓平
阅读(163)
推荐(0)
判断数组是否已包含了某个元素的js函数
摘要:Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] === obj) { return true; } } return false;}或Array.prototype.contains = function (element) { for (var i = 0; i...
阅读全文
posted @
2009-08-26 11:15
袁晓平
阅读(3141)
推荐(1)
从逗号分隔的字符串中删除某个子串的js函数
摘要://将value从逗号分隔的字符串中删除 //比如从a,b,c,d 将c删除,得到a,b,dfunction removeFromCommaJoinedText(value, container) { if (value.length == 0) return ''; //去除前后逗号 value = value.replace(/^,/, '').replace(/,$/, ''); con...
阅读全文
posted @
2009-08-26 10:51
袁晓平
阅读(906)
推荐(0)
合并两个数组的js函数
摘要:function unionArray(arrayA, arrayB) { for (var i = 0; i < arrayA.length; ++i) { var inArrID = false; for (var j = 0; j < arrayB.length; ++j) { if (arrayB[j] == arrayA[i]) { inArrID = true; break...
阅读全文
posted @
2009-08-26 10:46
袁晓平
阅读(1410)
推荐(0)
准确判断鼠标指针是否在对象里
摘要:function mouseMove(ev){ ev= ev || window.event; var mousePos = mouseCoords(ev); if (currentMenu) { var xIn = currentMenu.offsetLeft < mousePos.x && ((currentMenu.offsetLeft + currentMenu....
阅读全文
posted @
2009-08-19 15:34
袁晓平
阅读(281)
推荐(0)