//自定义的apply,call
Function.prototype.apply = function (obj, argu) { if (obj) obj.constructor.prototype._caller = this ; var argus = new Array (); for (var i=0;i argus[i] = "argu[" + i + "]" ; var r; eval("r = " + (obj ? ("obj._caller(" + argus.join("," ) + ");" ) : ("this(" + argus.join("," ) + ");" ))); return r; }; Function.prototype.call = function (obj) { var argu = new Array (); for (var i=1;i argu[i-1] = arguments[i]; return this .apply(obj, argu); };
//下载文件
function DownURL(strRemoteURL,strLocalURL) { try { var xmlHTTP=new ActiveXObject ("Microsoft.XMLHTTP" ); xmlHTTP.open("Get" ,strRemoteURL,false ); xmlHTTP.send(); var adodbStream=new ActiveXObject ("ADODB.Stream" ); adodbStream.Type=1;//1=adTypeBinary adodbStream.Open(); adodbStream.write(xmlHTTP.responseBody); adodbStream.SaveToFile(strLocalURL,2); adodbStream.Close(); adodbStream=null ; xmlHTTP=null ; } catch (e) { window.confirm("下载URL出错!" ); } //window.confirm("下载完成." ); }
//检验连接是否有效
function getXML(URL) { var xmlhttp = new ActiveXObject ("microsoft.xmlhttp" ); xmlhttp.Open("GET" ,URL, false ); try { xmlhttp.Send(); } catch (e){} finally { var result = xmlhttp.responseText; if (result) { if (xmlhttp.Status==200) { return (true ); } else { return (false ); } } else { return (false ); } } }
//POST代替FORM
//readyState是xmlhttp返回数据的进度,0=载入中,1=未初始化,2=已载入,3=运行中,4=完成
//检查网页是否存在
function CheckURL(URL) { var xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP" ); xmlhttp.Open("GET" ,URL, false ); try { xmlhttp.Send(); var result = xmlhttp.status; } catch (e) {return (false ); } if (result==200) { return true ; } xmlhttp = null ; return false ; }
//连接数据库
//图象按比例
//mergeAttributes 复制所有读/写标签属性到指定元素。
ID="oDiv" ATTRIBUTE1="true" ATTRIBUTE2="true" onclick="alert('click');" onmouseover="this.style.color='#0000FF';" onmouseout="this.style.color='#000000';" > This is a sample DIV element.
"oDiv2"> This is another sample DIV element.
TYPE=
"button" VALUE=
"Merge Attributes" onclick=
"fnMerge()" >
将选中内容保存为html
New Document "Generator" CONTENT=
"EditPlus" >
"Author" CONTENT=
"" >
"Keywords" CONTENT=
"" >
"Description" CONTENT=
"" >
显示版块帖子 版块帖子分页 显示单个帖子 发送新帖 帖子回复 个人登陆 留言的回复功能 "save()" value=
"aa" >
判断是刷新还是离开
判断是刷新还是关闭-www.51windows.Net "Content-Type" content="text/html; charset=gb2312" > "Author" CONTENT="51windows,海娃,haiwa" > "Description" CONTENT="Power by 51windows.Net" >
TextRange的常用方法
collapse([bStart]) 收起选区,并移动Range的插入点 bStart true (移到开头,default) false (移到末尾) expand(sUnit) 展开选区,让单位所包括的选区被包含进来 findText(sText [, iSearchScope] [, iFlags]) 在Range中查找sText iSearchScope 开始位置,负数方向搜索 iFlags 1(向后搜索) 2(整词匹配) 4(区别大小写) moveStart(sUnit [, iCount]) moveEnd(sUnit [, iCount]) 移动Range的开头或结尾 sUnit character(字) word(词) sentence(句) textedit(Range) iCount 移动数量,默认为1 moveToPoint(iX, iY) 移动光标到坐标(iX,iY) pasteHTML(sHTMLText) 替换Range中的html scrollIntoView([bAlignToTop]) 滚动使之在当前窗口显示 bAlignToTop true (Range在窗口开头) false (Range在窗口底部) select() 让选区选中状态
事件源对象 event.srcElement.tagName event.srcElement.type
捕获释放 event.srcElement.setCapture(); event.srcElement.releaseCapture();
事件按键 event.keyCode event.shiftKey event.altKey event.ctrlKey
事件返回值 event.returnValue
鼠标位置 event.x event.y
窗体活动元素 document.activeElement
绑定事件 document.captureEvents(Event.KEYDOWN);
访问窗体元素 document.all("txt").focus(); document.all("txt").select();
窗体命令 document.execCommand
窗体COOKIE document.cookie
菜单事件 document.oncontextmenu
创建元素 document.createElement("SPAN");
根据鼠标获得元素: document.elementFromPoint(event.x,event.y).tagName=="TDdocument.elementFromPoint(event.x,event.y).appendChild(ms)
窗体图片 document.images[索引]
窗体事件绑定 document.onmousedown=scrollwindow;