下载

2下载券

加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 ASP.NETjavascript小技巧

ASP.NETjavascript小技巧.doc

ASP.NETjavascript小技巧

飞行者
2018-09-05 0人阅读 举报 0 0 暂无简介

简介:本文档为《ASP.NETjavascript小技巧doc》,可适用于IT/计算机领域

javascript小技巧事件源对象eventsrcElementtagNameeventsrcElementtype捕获释放eventsrcElementsetCapture()eventsrcElementreleaseCapture()事件按键eventkeyCodeeventshiftKeyeventaltKeyeventctrlKey事件返回值eventreturnValue鼠标位置eventxeventy窗体活动元素documentactiveElement绑定事件documentcaptureEvents(EventKEYDOWN)访问窗体元素documentall("txt")focus()documentall("txt")select()窗体命令documentexecCommand窗体COOKIEdocumentcookie菜单事件documentoncontextmenu创建元素documentcreateElement("SPAN")根据鼠标获得元素:documentelementFromPoint(eventx,eventy)tagName=="TDdocumentelementFromPoint(eventx,eventy)appendChild(ms)窗体图片documentimages索引窗体事件绑定documentonmousedown=scrollwindow元素document窗体elements索引对象绑定事件documentallxxxdetachEvent('onclick',a)插件数目navigatorplugins取变量类型typeof($jslibpath)=="undefined"下拉框下拉框options索引下拉框optionslength查找对象documentgetElementsByName("r")documentgetElementById(id)定时timer=setInterval('scrollwindow()',delay)clearInterval(timer)UNCODE编码escape(),unescape父对象objparentElement(dhtml)objparentNode(dom)交换表的行TableIDmoveRow(,)替换CSSdocumentallcssshref"><BODY>无模式的提示框functionmodelessAlert(Msg){windowshowModelessDialog("javascript:alert(""escape(Msg)"")windowclose()","","status:noresizable:nohelp:nodialogHeight:height:pxdialogHeight:px")}屏蔽按键<html><head><metahttpequiv="ContentType"content="texthtmlcharset=gb"><noscript><metahttpequiv="refresh"content="url=about:noscript"><noscript><title>屏蔽鼠标右键、CtrlN、ShiftF、AltF、F、F刷新、退格键<title><head><body><scriptlanguage="Javascript"><!屏蔽鼠标右键、CtrlN、ShiftF、F、F刷新、退格键Author:meizz(梅花雨)functiondocumentoncontextmenu(){eventreturnValue=false}屏蔽鼠标右键functionwindowonhelp(){returnfalse}屏蔽F帮助functiondocumentonkeydown(){if((windoweventaltKey)((windoweventkeyCode==)||屏蔽Alt方向键←(windoweventkeyCode==)))屏蔽Alt方向键→{alert("不准你使用ALT方向键前进或后退网页!")eventreturnValue=false}*注:这还不是真正地屏蔽Alt方向键因为Alt方向键弹出警告框时按住Alt键不放用鼠标点掉警告框这种屏蔽方法就失效了。以后若有哪位高手有真正屏蔽Alt键的方法请告知。*if((eventkeyCode==)||屏蔽退格删除键(eventkeyCode==)||屏蔽F刷新键(eventctrlKeyeventkeyCode==)){CtrlReventkeyCode=eventreturnValue=false}if(eventkeyCode==){eventkeyCode=eventreturnValue=false}屏蔽Fif(eventctrlKeyeventkeyCode==)eventreturnValue=false屏蔽Ctrlnif(eventshiftKeyeventkeyCode==)eventreturnValue=false屏蔽shiftFif(windoweventsrcElementtagName=="A"windoweventshiftKey)windoweventreturnValue=false屏蔽shift加鼠标左键新开一网页if((windoweventaltKey)(windoweventkeyCode==))屏蔽AltF{windowshowModelessDialog("about:blank","","dialogWidth:pxdialogheight:px")returnfalse}}<script>屏蔽鼠标右键、CtrlN、ShiftF、AltF、F、F刷新、退格键<body><html>屏蔽打印<style>mediaprint{*{display:none}}<style>移动的图层拖动<spanstyle='position:absolutewidth:height:background:red'onmousedown=MouseDown(this)onmousemove=MouseMove()onmouseup=MouseUp()>meizz<span><scriptlanguage=javascript>varObjfunctionMouseDown(obj){Obj=objObjsetCapture()Objl=eventxObjstylepixelLeftObjt=eventyObjstylepixelTop}functionMouseMove(){if(Obj!=){Objstyleleft=eventxObjlObjstyletop=eventyObjt}}functionMouseUp(){if(Obj!=){ObjreleaseCapture()Obj=}}<script><divid="myDiv"src="logogif"ondrag="doDrag()"onmouseover="thisstylecursor='hand'"style="position:absoluteleft=top="onmousedown="doMouseDown()"><ahref="#"onclick="returnfalse"><h>wlecome<h><a><div><scriptlanguage="JavaScript"type="textjavascript">varorgMouseXvarorgMouseYvarorgObjXvarorgObjYfunctiondoDrag(){varmyObject=documentallmyDivvarx=eventclientXvary=eventclientYmyObjectstyleleft=x(orgMouseXorgObjX)myObjectstyletop=y(orgMouseYorgObjY)}functiondoMouseDown(){orgMouseX=eventclientXorgMouseY=eventclientYorgObjX=parseInt(documentallmyDivstyleleft)orgObjY=parseInt(documentallmyDivstyletop)}<script>文档状态改变<iframesrc="ahtml"id="f"name="f"scrolling="no"frameborder=marginwidth=marginheight=><iframe><script>vardoc=windowframes"f"documentfunctions(){if(docreadyState=="complete"){documentallfstyleheight=docbodyscrollHeightdocumentallfstylewidth=docbodyscrollWidth}}doconreadystatechange=s<script>刷新后不变的文本框<HTML><HEAD><METANAME="save"CONTENT="history"><STYLE>sHistory{behavior:url(#default#savehistory)}<STYLE><HEAD><BODY><INPUTclass=sHistorytype=textid=oPersistInput><BODY><HTML>访问剪贴板()拖拽访问eventdataTransfersetData("URL",oImagesrc)sImageURL=eventdataTransfergetData("URL")()普通访问windowclipboardDatasetData("Text",oSourceinnerText)windowclipboardDatagetData("Text")操作COOKIEfunctionSetCookie(sName,sValue){documentcookie=sName"="escape(sValue)""}functionGetCookie(sName){varaCookie=documentcookiesplit("")for(vari=i<aCookielengthi){varaCrumb=aCookieisplit("=")if(sName==aCrumb)returnunescape(aCrumb)}}functionDelCookie(sName){documentcookie=sName"="escape(sValue)"expires=Fri,Dec::GMT"}setTimeout增加参数<script>varst=windowsetTimeoutwindowsetTimeout=function(fRef,mDelay){if(typeoffRef=='function'){varargu=Arrayprototypeslicecall(arguments,)varf=(function(){fRefapply(,argu)})returnst(f,mDelay)}returnst(fRef,mDelay)}functiontest(x){alert(x)}windowsetTimeout(test,,'fason')<script>自定义的apply,callFunctionprototypeapply=function(obj,argu){if(obj)objconstructorprototypecaller=thisvarargus=newArray()for(vari=i<argulengthi)argusi="argu"i""varreval("r="(obj("objcaller("argusjoin(",")")"):("this("argusjoin(",")")")))returnr}Functionprototypecall=function(obj){varargu=newArray()for(vari=i<argumentslengthi)argui=argumentsireturnthisapply(obj,argu)}下载文件functionDownURL(strRemoteURL,strLocalURL){try{varxmlHTTP=newActiveXObject("MicrosoftXMLHTTP")xmlHTTPopen("Get",strRemoteURL,false)xmlHTTPsend()varadodbStream=newActiveXObject("ADODBStream")adodbStreamType==adTypeBinaryadodbStreamOpen()adodbStreamwrite(xmlHTTPresponseBody)adodbStreamSaveToFile(strLocalURL,)adodbStreamClose()adodbStream=xmlHTTP=}catch(e){windowconfirm("下载URL出错!")}windowconfirm("下载完成")}检验连接是否有效functiongetXML(URL){varxmlhttp=newActiveXObject("microsoftxmlhttp")xmlhttpOpen("GET",URL,false)try{xmlhttpSend()}catch(e){}finally{varresult=xmlhttpresponseTextif(result){if(xmlhttpStatus==){return(true)}else{return(false)}}else{return(false)}}}POST代替FORM<SCRIPTlanguage="VBScript">FunctionURLEncoding(vstrIn)strReturn=""Fori=ToLen(vstrIn)ThisChr=Mid(vStrIn,i,)IfAbs(Asc(ThisChr))<HFFThenstrReturn=strReturnThisChrElseinnerCode=Asc(ThisChr)IfinnerCode<TheninnerCode=innerCodeHEndIfHight=(innerCodeAndHFF)HFFLow=innerCodeAndHFFstrReturn=strReturn""Hex(Hight)""Hex(Low)EndIfNextURLEncoding=strReturnEndFunctionFunctionbytesBSTR(vIn)strReturn=""Fori=ToLenB(vIn)ThisCharCode=AscB(MidB(vIn,i,))IfThisCharCode<HThenstrReturn=strReturnChr(ThisCharCode)ElseNextCharCode=AscB(MidB(vIn,i,))strReturn=strReturnChr(CLng(ThisCharCode)*HCInt(NextCharCode))i=iEndIfNextbytesBSTR=strReturnEndFunctiondimstrA,oReqstrA=URLEncoding("submit=Submittext=中文")setoReq=CreateObject("MSXMLXMLHTTP")oReqopen"POST","http:ServerNameVDirTstResultasp",falseoReqsetRequestHeader"ContentLength",Len(strA)oReqsetRequestHeader"CONTENTTYPE","applicationxwwwformurlencoded"oReqsendstrAmsgboxbytesBSTR(oReqresponseBody)<SCRIPT>readyState是xmlhttp返回数据的进度=载入中,=未初始化,=已载入,=运行中,=完成组件是否安装isComponentInstalled("{BABAECDDBFFAA}","componentID"))检查网页是否存在functionCheckURL(URL){varxmlhttp=newActiveXObject("MicrosoftXMLHTTP")xmlhttpOpen("GET",URL,false)try{xmlhttpSend()varresult=xmlhttpstatus}catch(e){return(false)}if(result==){returntrue}xmlhttp=returnfalse}连接数据库<scriptlanguage="javascript">用JavaScript写服务器端连接数据库的代码示例varconn=newActiveXObject("ADODBConnection")connOpen("Provider=SQLOLEDBDataSource=localhostUserID=sa""Password=InitialCatalog=pubs")varrs=newActiveXObject("ADODBRecordset")varsql="select*fromauthors"rsopen(sql,conn)shtml="<tablewidth=''border=>"shtml="<trbgcolor='#fff'><td>auid<td><td>aulname<td><td>aufname<td><td>phone<td><td>address<td><td>city<td><td>state<td><td>zip<td><tr>"while(!rsEOF){shtml="<tr><td>"rs("auid")"<td><td>"rs("aulname")"<td><td>"rs("aufname")"<td><td>"rs("phone")"<td><td>"rs("address")"<td><td>"rs("city")"<td><td>"rs("state")"<td><td>"rs("zip")"<td><tr>"rsmoveNext}shtml="<table>"documentwrite(shtml)rsclose()rs=connclose()conn=<script>使用数据岛<html><body>srno:<inputtype=textdatasrc=#xmldateDataFLD=srnosize=""><BR>times:<inputtype=textdatasrc=#xmldateDataFLD=timessize=""><BR><inputid="first"TYPE=buttonvalue="<< 第一条记录"onclick="xmldaterecordsetmoveFirst()"><inputid="prev"TYPE=buttonvalue="<上一条记录"onclick="xmldaterecordsetmovePrevious()"><inputid="next"TYPE=buttonvalue="下一条记录>"onclick="xmldaterecordsetmoveNext()"><inputid="last"TYPE=buttonvalue="最后一条记录>>"onclick="xmldaterecordsetmoveLast()"><inputid="Add"TYPE=buttonvalue="添加新记录"onclick="xmldaterecordsetaddNew()"><XMLID="xmldate"><infolist><info><srno><srno><times><times><info><info><srno><srno><times>年月日点分秒<times><info><infolist><XML><body><html>获得参数<body><ahref="javascript:locationhref=locationhref'a=b='">search<a><scriptlanguage="JavaScript"><!vara=locationsearchsubstr()if(alength>){varre=(^*)=(^*)gvars=amatch(re)for(vari=i<slengthi){alert(si)alert(sisplit("="))}}><script><body>可编辑SELECT<inputtype=textname=renamestyle="width:pxheight:pxfontsize:pt"><spanstyle="width:pxborder:pxsolidred"><selectname="r"style="marginleft:pxwidth:pxbackgroundcolor:#FFEEEE"onChange="documentallrenamevalue=thisvalue"><optionvalue=""><option><optionvalue=""><option><optionvalue=""><option><select><span>设置光标位置functiongetCaret(textbox){varcontrol=documentactiveElementtextboxfocus()varrang=documentselectioncreateRange()rangsetEndPoint("StartToStart",textboxcreateTextRange())controlfocus()returnrangtextlength}functionsetCaret(textbox,pos){try{varr=textboxcreateTextRange()rmoveStart('character',pos)rcollapse(true)rselect()}catch(e){}}functionselectLength(textbox,start,len){try{varr=textboxcreateTextRange()rmoveEnd('character',len(textboxvaluelengthstart))rmoveStart('character',start)rselect()}catch(e){alert(edescription)}}functioninsertAtCaret(textbox,text){textboxfocus()documentselectioncreateRange()text=text}页内查找functionfindInPage(str){vartxt,i,found,n=if(str==""){returnfalse}txt=documentbodycreateTextRange()for(i=i<=n(found=txtfindText(str))!=falsei){txtmoveStart("character",)txtmoveEnd("textedit")}if(found){txtmoveStart("character",)txtfindText(str)txtselect()txtscrollIntoView()n}else{if(n>){n=findInPage(str)}else{alert(str"您要找的文字不存在。nn请试着输入页面中的关键字再次查找!")}}returnfalse}书http:wwwitpubnetattachmentphps=postid=http:wwwwrclubnetdownlistdownaspxid=操作EXECL<scriptlanguage="javascript">functionjStartExcel(){varxls=newActiveXObject("ExcelApplication")xlsvisible=truevarnewBook=xlsWorkbooksAddnewBookWorksheetsAddnewBookWorksheets()ActivatexlsActiveWorkBookActiveSheetPageSetupOrientation=xlsActiveWorkBookActiveSheetPageSetupPaperSize=newBookWorksheets()Columns("A")columnwidth=newBookWorksheets()Columns("A")WrapText=truenewBookWorksheets()Columns("B")columnwidth=newBookWorksheets()Columns("B")WrapText=truenewBookWorksheets()Range("A:B")NumberFormat=""newBookWorksheets()Range("A:B")HorizontalAlignment=newBookWorksheets()Cells(,)InteriorColorIndex=""newBookWorksheets()Cells(,)value="FirstColumn,FirstCell"newBookWorksheets()Cells(,)value="FirstColumn,SecondCell"newBookWorksheets()Cells(,)value="SecondColumn,FirstCell"newBookWorksheets()Cells(,)value="SecondColumn,SecondCell"newBookWorksheets()Name="MyFirstWorkSheet"}<script>自定义提示条<ahref="#"title="这是提示">tip<a><scriptLanguage="JavaScript">***********默认设置定义*********************tPopWait=停留tWait豪秒后显示提示。tPopShow=显示tShow豪秒后关闭提示showPopStep=popOpacity=***************内部变量定义*****************sPop=curShow=tFadeOut=tFadeIn=tFadeWaiting=documentwrite("<styletype='textcss'id='defaultPopStyle'>")documentwrite("cPopText{backgroundcolor:#FFFcolor:#border:px#solidfontcolor:fontsize:pxpaddingright:pxpaddingleft:pxheight:pxpaddingtop:pxpaddingbottom:pxfilter:Alpha(Opacity=)}")documentwrite("<style>")documentwrite("<divid='dypopLayer'style='position:absolutezindex:'class='cPopText'><div>")functionshowPopupText(){varo=eventsrcElementMouseX=eventxMouseY=eventyif(oalt!=oalt!=""){odypop=oaltoalt=""}if(otitle!=otitle!=""){odypop=otitleotitle=""}if(odypop!=sPop){sPop=odypopclearTimeout(curShow)clearTimeout(tFadeOut)clearTimeout(tFadeIn)clearTimeout(tFadeWaiting)if(sPop==||sPop==""){dypopLayerinnerHTML=""dypopLayerstylefilter="Alpha()"dypopLayerfiltersAlphaopacity=}else{if(odyclass!=)popStyle=odyclasselsepopStyle="cPopText"curShow=setTimeout("showIt()",tPopWait)}}}functionshowIt(){dypopLayerclassName=popStyledypopLayerinnerHTML=sPoppopWidth=dypopLayerclientWidthpopHeight=dypopLayerclientHeightif(MouseXpopWidth>documentbodyclientWidth)popLeftAdjust=popWidthelsepopLeftAdjust=if(MouseYpopHeight>documentbodyclientHeight)popTopAdjust=popHeightelsepopTopAdjust=dypopLayerstyleleft=MouseXdocumentbodyscrollLeftpopLeftAdjustdypopLayerstyletop=MouseYdocumentbodyscrollToppopTopAdjustdypopLayerstylefilter="Alpha(Opacity=)"fadeOut()}functionfadeOut(){if(dypopLayerfiltersAlphaopacity<popOpacity){dypopLayerfiltersAlphaopacity=showPopSteptFadeOut=setTimeout("fadeOut()",)}else{dypopLayerfiltersAlphaopacity=popOpacitytFadeWaiting=setTimeout("fadeIn()",tPopShow)}}functionfadeIn(){if(dypopLayerfiltersAlphaopacity>){dypopLayerfiltersAlphaopacity=tFadeIn=setTimeout("fadeIn()",)}}documentonmouseover=showPopupText<script>插入文字documentonclick=function(){varoSource=windoweventsrcElementif(oSourcetagName!="DIV")returnfalsevarsel=documentselectionif(sel!=){varrng=selcreateRange()if(rng!=)rngpasteHTML("<fontcolor=red>插入文字<font>")}}netscapte下操作xmldoc=newActiveXObject("MsxmlDOMDocument")doc=newActiveXObject("MicrosoftXMLDOM")>>doc=(newDOMParser())parseFromString(sXML,'textxml')判断键值<html><metahttpequiv="ContentType"content="texthtmlcharset=gb"><head><scriptlanguage="javascript">varie=navigatorappName=="MicrosoftInternetExplorer"true:falsefunctionkeyDown(e){if(!ie){varnkey=ewhichvariekey='现在是ns浏览器'varrealkey=StringfromCharCode(ewhich)}if(ie){variekey=eventkeyCodevarnkey='现在是ie浏览器'varrealkey=StringfromCharCode(eventkeyCode)if(eventkeyCode==){realkey=''空格''}if(eventkeyCode==){realkey=''回车''}if(eventkeyCode==){realkey=''Esc''}if(eventkeyCode==){realkey=''Shift''}if(eventkeyCode==){realkey=''Ctrl''}if(eventkeyCode==){realkey=''Alt''}}alert('ns浏览器中键值:'nkey'n''ie浏览器中键值:'iekey'n''实际键为'realkey)}documentonkeydown=keyDown<script><head><body>JavascriptDocument<hr><center><h>请按任意一个键。。。。<h><center><body><html>禁止FSO注销组件regsvruscrrundll修改PROGIDHKEYCLASSESROOTScriptingFileSystemObjectScriptingFileSystemObject对于使用object的用户修改HKEYCLASSESROOTScripting省略号<DIVSTYLE="width:pxheight:pxborder:pxsolidblueoverflow:hiddentextoverflow:ellipsis"><NOBR>就是比如有一行文字很长表格内一行显示不下<NOBR><DIV>检测mediaplay版本<IE:clientCapsID="oClientCaps"style="{behavior:url(#default#clientcaps)}"><SCRIPT>varflash=""WMPVersion=oClientCapsgetComponentVersion("{DFBFDABCCE}","ComponentID")if(WMPVersion!=""){flash=""varversion=WMPVersionsplit(",")varifor(i=i<versionlengthi){if(i!=)flash=""flash=versioni}documentwrite("您的WindowsMediaPlayer版本是:"flash"<p>")}<SCRIPT>图象按比例<scriptlanguage="JavaScript"><!图片按比例缩放varflag=falsefunctionDrawImage(ImgD){varimage=newImage()variwidth=定义允许图片宽度variheight=定义允许图片高度imagesrc=ImgDsrcif(imagewidth>imageheight>){flag=trueif(imagewidthimageheight>=iwidthiheight){if(imagewidth>iwidth){ImgDwidth=iwidthImgDheight=(imageheight*iwidth)imagewidth}else{ImgDwidth=imagewidthImgDheight=imageheight}ImgDalt=imagewidth"×"imageheight}else{if(imageheight>iheight){ImgDheight=iheightImgDwidth=(imagewidth*iheight)imageheight}else{ImgDwidth=imagewidthImgDheight=imageheight}ImgDalt=imagewidth"×"imageheight}}}><script><imgsrc=""onload="DrawImage(this)">细线SELECT<spanstyle="border:pxsolid#position:absoluteoverflow:hidden"><selectstyle="margin:px"><option><option><option><option><option><option><select><span>ImportfunctionImport(){for(vari=i<argumentslengthi){varfile=argumentsiif(filematch(js$i))documentwrite('<scripttype="textjavascript"src="'file'"><sc''ript>')elsedocumentwrite('<styletype="textcss">import"'file'"<style>')}}js枚举functiongetComputerName(){varobjWMIService=GetObject("Winmgmts:rootcimv")for(e=newEnumerator(objWMIService)!eatEnd()emoveNext()){vargetComputer=eitem()returngetComputerName}}条件编译<scriptlanguage=javascript>*ccon**if(winjscriptversion>)functionwindowconfirm(str){execScript("n=msgbox('"str"',)","vbscript")return(n==)}end*<script>取得innerText<SCRIPTLANGUAGE="JavaScript"><!varxmlDoc=newActiveXObject("MsxmlDOMDocument")varcurrNodexmlDocasync=falsexmlDocasync=falsexmlDocloadXML("<TABLENAME>你好你阿三大法司法等四<TABLENAME>")currNode=xmlDocdocumentElementvars=currNodexmlvarr=<(^>s*)^>*>(^<*)<>varb=sreplace(r,"$")alert(b)><SCRIPT>mergeAttributes复制所有读写标签属性到指定元素。<SCRIPT>functionfnMerge(){oSourcechildrenmergeAttributes(oSourcechildren)}<SCRIPT><SPANID=oSource><DIVID="oDiv"ATTRIBUTE="true"ATTRIBUTE="true"onclick="alert('click')"onmouseover="thisstylecolor='#FF'"onmouseout="thisstylecolor='#'">Thisisasample<B>DIV<B>element<DIV><DIVID="oDiv">Thisisanothersample<B>DIV<B>element<DIV><SPAN><INPUTTYPE="button"VALUE="MergeAttributes"onclick="fnMerge()">以上内容可以随意转载转载后请注名来源和出处!postedon:ttyp阅读()评论()编辑收藏收藏至Key所属分类:脚本评论#请教英文字符自动换行的问题:Shrek各位高手小弟对程序一知半解最近在翻译一个中文电子商务平台的时候遇到这样一个问题在后台管理程序中贴入的中文文字信息可以在html页面表格中自动换行而一贴入英文段落就不能自动换行了而是每个段落一行到底。经查原代码字符转换程序是这样写的:<functionnewsConvert(str)dimtempstrdimtheStrdimcanConvertdimtheChrtempStr=strtheChr=""theStr=""canConvert=fori=tolen(tempStr)theChr=mid(tempStr,i,)iftheChr="<"thencanConvert=endififtheChr=">"thencanConvert=endififtheChr=""andcanConvert=thentheChr=""endiftheStr=theStrtheChrnexttheStr=replace(theStr,chr(),"<br>")newsConvert=theStrEndfunction>请教各位高手是不是该转换程序有缺陷才导致的上述问题?小弟这里先行谢过!!回复#re:javascript小技巧:ttyptrytheStr=replace(theStr,chr()chr(),"<br>")ortheStr=replace(theStr,chr(),"<br>")回复#javascript小技巧TrackBack:funPingBack来自:blogcsdnnetfun引用了该文章,地址:http:blogcsdnnetfunarchiveaspx回复#re:javascript小技巧:dddddddd回复#re:javascript小技巧:沉默天蝎的net学习汇集我把你这篇文章放到了我的blog因为我对于javascript不熟感觉你这个非常好谢谢了回复#re:javascript小技巧:dancersodoi我正找这个千恩万谢!回复#re:javascript小技巧:听棠NET收藏!!!楼主我有个问题给你发留言了。求救啊!回复#re:javascript小技巧:abc去掉打印时的页眉页脚,不管用回复#re:javascript小技巧:ttyptoabc:这个是需要权限的回复#re:javascript小技巧:厚道的人我想在页面载入的时候去掉打印时的页眉页脚可是用上面的方法程序只能走到这里varWsh=newActiveXObject("WScriptShell")我的<body>的设置是<bodyid="test"onload="pagesetup()"onunload="pagesetupdefault()">回复#re:javascript小技巧:ttyp报什么错啊回复#re:javascript小技巧:菜鸟在日本我正在开发的项目要求用Javascript区分出当前事件是浏览器的关闭按钮还是其他(向前回退刷新等)。在IE里我通过判断坐标区分出来了可是在Netscipt里区分不出来。有那位高人知道?回复#re:javascript小技巧:BushII太笨了通过得到点击对象的id值来判断就行了回复#re:javascript小技巧:JK内容很多不错不错值得推荐回复#re:javascript小技巧:王广军这个非常不错我也正在学JavaScript太有帮助了!回复#re:javascript小技巧:keen厉害~回复#re:javascript小技巧:alittlefish收藏!!!回复#re:javascript小技巧:冰戈的确是好东西!收藏了回复#re:javascript小技巧:ezwyj有没有二期,请楼主多多发布,太提高技术了,万分感谢!!回复#re:javascript小技巧:leo好东东,先顶顶!我也碰到这个问题:去掉打印时的页眉页脚可是用上面的方法程序只能走到这里varWsh=newActiveXObject("WScriptShell")请问如何解决回复#re:javascript小技巧:Leo自己已解决问题方法:把网站设成可信任就行但是这样每次打开页面都有询问窗口请问有无其它方法?回复#re:javascript小技巧:ttyp询问窗口是肯定有的了这个是安全机制除非你做成activex控件还要获得安全证书回复#re:javascript小技巧:ShuKK关于"屏蔽按键"假如加入下列input当光标在这个input上时有办法屏蔽按键吗?(最主要的时这时eventkeyCode=出错)<inputid="file"type=file>回复#re:javascript小技巧:ttyp<inputid="file"type=fileonkeypress="returnfalse">回复#re:javascript小技巧:ShuKK关于"屏蔽按键"的再回复我想ttyp的<inputid="file"type=fileonkeypress="returnfalse">代码是应该经过测试的吧(如果没有测试期望下次能测试一下)难道IE版本不一样吗?在我的机器上(IEsp)不能通过就是说不能屏蔽按键回复#re:javascript小技巧:ttyp当然经过测试我的机器是SERVERIESP不能输入但是可以粘贴事实上我的代码基本上都是经过测试的才贴出来当然也有可能测试不全面回复#re:javascript小技巧:ttyp又测试了一次发现可以输入中文你测试下<inputid="file"type=fileonkeypress="returnfalse"onkeydown="returnfalse">回复#re:javascript小技巧:ShuKK关于"屏蔽按键"的再回复麻烦ttyp再确认一下下列代码当光标在输入框中时按下F或F,F等是不是没有屏蔽掉?我的IE版本与您的不一样但我想是不是基于安全原因file的特别处理因为file的value也是不可设置的。<inputid="file"type=fileonkeypress="returnfalse"onkeydown="returnfalse">回复#re:javascript小技巧:ttyp不知道你是怎么回事了按FFF没什么问题啊,file的value是不能设置的这个是基于安全考虑如果能设置就可能产生漏洞泄露客户端的文件回复#re:javascript小技巧:ShuKK很抱歉不是我怎么回事是我的或你的IE有那么回事。在我的IEVersion:xpspspgdr上当光标在上述条件的输入框中时按下F后会出现检索动作。按F则会全屏。按键没被屏蔽掉。谢谢您让我注意到这个处理在IE不同版本会有不同的动作。有机会我会确认试试。回复#re:javascript小技巧:ttyp对不起这些不是IE能干的事也和FILE控件无关这些都是IE自带的快捷方式IE也不能屏蔽系统的快捷方式如:altf,winf,ctrlaltdel等如果你确实需要可以考虑用CS程序或者专门编写一个屏蔽的控件可能可行回复#re:javascript小技巧:ShuKK当在html文档中作如下设置时即使光标在text或textarea输入框上确实能屏蔽掉。但光标在FILE控件就不行。我查onkeydown关键词来的您的地盘有很多受益。现在我模仿gmail上传文件的做法把FILE控件hidden起来自己控制解决了。在FILE控件输入时能截取但设置eventkeyCode=出错。谢谢您的回复。noF,F,Forotherkeysdocumentonkeydown=sysonkeydownfunctionsysonkeydown(){F,F,Fif(eventkeyCode==||eventkeyCode==||eventkeyCode==){try{eventreturnValue=falseeventcancelBubble=trueeventkeyCode=}catch(exp){}returnfalse}returntrue}回

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

文档小程序码

使用微信“扫一扫”扫码寻找文档

1

打开微信

2

扫描小程序码

3

发布寻找信息

4

等待寻找结果

我知道了
评分:

/38

ASP.NETjavascript小技巧

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利