随笔分类 -  JavaScript

摘要:在应用有frameset或者iframe的页面时,parent是父窗口,top是最顶级父窗口(有的窗口中套了好几层frameset或者iframe),self是当前窗口, opener是用open方法打开当前窗口的那个窗口。window.self功能:是对当前窗口自身的引用。它和window属性是等... 阅读全文
posted @ 2014-11-28 23:41 荡来荡去(allen) 阅读(410) 评论(0) 推荐(0)
摘要:名称返回类型描述validate(options)返回:Validator验证所选的FORMvalid()返回:Boolean检查是否验证通过rules()返回:Options返回元素的验证规则rules("add",rules)返回:Options增加验证规则rules("remove",rules)返回:Options删除验证规则removeAttrs(attributes)返回:Options删除特殊属性并且返回他们Custom selectors:blank返回:Validator没有值的筛选器:filled返回:Array <Elemen 阅读全文
posted @ 2013-02-17 21:30 荡来荡去(allen) 阅读(183) 评论(0) 推荐(0)
摘要:项目中有时会用到自动补全查询,就像Google搜索框、淘宝商品搜索功能,输入汉字或字母,则以该汉字或字母开头的相关条目会显示出来供用户选择, autocomplete插件就是完成这样的功能。 autocomplete官网 : http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ (可下载jQuery autocomplete插件)。 淘宝商品搜索功能 效果:下面来使用autocomplete插件来实现类似效果。1. 创建AjaxPage.aspx 页面,在其中定义WebMethod 方法来返回 搜索页面需要的输入框.. 阅读全文
posted @ 2012-09-26 14:02 荡来荡去(allen) 阅读(1153) 评论(2) 推荐(0)
摘要:第一种:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>js获得光标所在的文本框 阅读全文
posted @ 2012-04-20 15:27 荡来荡去(allen) 阅读(1984) 评论(1) 推荐(0)
摘要:1. document.form.item 问题 问题: 现有代码中存在许多 document.formName.item("itemName") 这样的语句,不能在Firefox下运行 解决方法: 统一使用 document.formName.elements["elementName"]2. 集合类对象问题 问题: IE下,可以使用()或[]获取集合类对象;Firefox下,只能使用[]获取集合类对象 解决方法: 改用[ ]作为下标运算。如:document.forms("formName") 改为 document.forms[ 阅读全文
posted @ 2012-03-31 15:25 荡来荡去(allen) 阅读(1410) 评论(2) 推荐(1)
摘要:<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>IE6 position:fixed bug</title><style>*{padding:0;margin:0}p{height:2000px}#gs{border:1px solid #000;position:fixed;right:30px;top:120px 阅读全文
posted @ 2011-12-01 15:15 荡来荡去(allen) 阅读(385) 评论(0) 推荐(0)
摘要:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- saved from url=(0045)http://www.ctaxnews.com.cn/temp/jsq/gssds.htm --><HTML><HEAD><TITLE>个人所得税计算器</TITLE><META http-equiv=Content-type content="text/html; charset=gb2312"> 阅读全文
posted @ 2011-11-18 11:46 荡来荡去(allen) 阅读(1791) 评论(0) 推荐(0)
摘要:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title>生活百宝箱--万年历</title> <meta http-equiv="Content-Type&qu 阅读全文
posted @ 2011-11-18 11:39 荡来荡去(allen) 阅读(614) 评论(1) 推荐(0)
摘要:<!DOCTYPE html><html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Sortable - Portlets</title> <script src="jquery-1.6.2.js"></script> <script src="jquery.ui.core.js"></script> <script 阅读全文
posted @ 2011-11-14 11:54 荡来荡去(allen) 阅读(3672) 评论(0) 推荐(0)
摘要:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywor 阅读全文
posted @ 2011-11-07 14:40 荡来荡去(allen) 阅读(1112) 评论(0) 推荐(0)
摘要:<script type="text/javascript"> $(document).ready(function() { alert($(window).height()); //浏览器时下窗口可视区域高度 alert($(document).height()); //浏览器时下窗口文档的高度 alert($(document.body).height());//浏览器时下窗口文档body的高度 alert($(document.body).outerHeight(true));//浏览器时下窗口文档body的总高度 包括border padding mar 阅读全文
posted @ 2011-10-06 15:19 荡来荡去(allen) 阅读(101978) 评论(2) 推荐(7)
摘要:query取得iframe中元素的几种方法在iframe子页面获取父页面元素代码如下:$('#objId', parent.document);// 搞定...在父页面 获取iframe子页面的元素代码如下:$("#objid",document.frames('iframename').document) $(document.getElementById('iframeId').contentWindow.document.body).html()显示iframe中body元素的内容。$("#testId&quo 阅读全文
posted @ 2011-10-06 15:04 荡来荡去(allen) 阅读(66414) 评论(3) 推荐(2)
摘要:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords 阅读全文
posted @ 2011-09-24 14:39 荡来荡去(allen) 阅读(2253) 评论(3) 推荐(0)
摘要:JS 操作IE游览器常用函数:window.external,history,document.execCommand js 操作IE游览器 window.external...1、window.external...<INPUT onclick='window.external.ImportExportFavorites(true,"http://localhost");' type=button value=导入收藏夹> <INPUT onclick='window.external.ImportExportFavorites( 阅读全文
posted @ 2011-09-09 10:14 荡来荡去(allen) 阅读(357) 评论(0) 推荐(0)
摘要:1.文本框焦点问题onBlur:当失去输入焦点后产生该事件onFocus:当输入获得焦点后,产生该文件Onchange:当文字值改变时,产生该事件Onselect:当文字加亮后,产生该文件<input type="text" value="mm" onfocus="if(value=='mm) {value=''}" onblur="if(value=='') {value='mm'}">点击时文字消失,失去焦点时文字再出现2.网页按钮的特殊颜色& 阅读全文
posted @ 2011-09-06 13:44 荡来荡去(allen) 阅读(776) 评论(0) 推荐(0)
摘要:代表颜色:<input name="txtColorValue" type="text" id="txtColorValue" class="inputText" onclick="colordialog()" onblur="LoadColor()" style="width:120px;" /><input type="text" class="inputText" id="txtEx 阅读全文
posted @ 2011-06-23 15:29 荡来荡去(allen) 阅读(779) 评论(1) 推荐(0)
摘要:<script language ="javascript" type ="text/javascript"> function UpdateSrc() { if(document.getElementById ("txt_Time").value=="") { alert ("请选择时间"); return ; } document.getElementById("report").src = "AutoMPSSysList.aspx?Date=&qu 阅读全文
posted @ 2011-05-13 08:52 荡来荡去(allen) 阅读(896) 评论(0) 推荐(0)
摘要:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><title>浮动广告</title><script type="text/javascript"> var tips; var theTop = 50/*这是默认高度,越大越往下*/; var old = theTop; function initFloatTips() { tips = document.getElementById( 阅读全文
posted @ 2011-05-12 11:43 荡来荡去(allen) 阅读(2900) 评论(0) 推荐(0)
摘要:http://www.cnblogs.com/cloudgamer/archive/2010/07/29/SlideView.htmlhttp://www.cnblogs.com/cloudgamer/archive/2008/07/06/1236770.html 阅读全文
posted @ 2011-05-05 20:57 荡来荡去(allen) 阅读(435) 评论(0) 推荐(0)
摘要:<HTML><HEAD><TITLE>JavaScript利用IE内置打印控件IEWebBrowser进行打印/打印页面设置/打印预览/控制分页打印</TITLE><META http-equiv=Content-Type content="text/html; charset=gbk" /><SCRIPT type="text/javascript"> var hkey_root,hkey_path,hkey_key;hkey_root="HKEY_CURRENT_USE 阅读全文
posted @ 2011-03-31 09:57 荡来荡去(allen) 阅读(257) 评论(0) 推荐(0)