小鎮(zhèn)樹妖--住在樹上的妖

          To follow the path: look to the master, follow the master, walk with the master, see through the master, become the master.

            BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
            10 Posts :: 50 Stories :: 7 Comments :: 0 Trackbacks

          1. oncontextmenu="window.event.returnvalue=false" 將徹底屏蔽鼠標(biāo)右鍵
          <table border oncontextmenu=return(false)><td>no</table> 可用于Table
          2. <body onselectstart="return false"> 取消選取、防止復(fù)制

          3. onpaste="return false" 不準(zhǔn)粘貼

          4. oncopy="return false;" oncut="return false;" 防止復(fù)制

          5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址欄前換成自己的圖標(biāo)

          6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夾中顯示出你的圖標(biāo)

          7. <input style="ime-mode:disabled"> 關(guān)閉輸入法

          8. 永遠(yuǎn)都會(huì)帶著框架
          <script language="javascript"><!--
          if (window == top)top.location.href = "frames.htm"; //frames.htm為框架網(wǎng)頁(yè)
          // --></script>

          9. 防止被人frame
          <SCRIPT LANGUAGE=javascript><!--
          if (top.location != self.location)top.location=self.location;
          // --></SCRIPT>

          10. <noscript><iframe src=*.html></iframe></noscript> 網(wǎng)頁(yè)將不能被另存為

          11. <input type=button value=查看網(wǎng)頁(yè)源代碼
          onclick="window.location = 'view-source:'+ 'http://www.csdn.net/'">

          12. 怎樣通過(guò)asp的手段來(lái)檢查來(lái)訪者是否用了代理
          <% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
          response.write "<font color=#FF0000>您通過(guò)了代理服務(wù)器,"& _
          "真實(shí)的IP為"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
          end if
          %>

          13. 取得控件的絕對(duì)位置

          //javascript
          <script language="javascript">
          function getIE(e){
          var t=e.offsetTop;
          var l=e.offsetLeft;
          while(e=e.offsetParent){
          t+=e.offsetTop;
          l+=e.offsetLeft;
          }
          alert("top="+t+"\nleft="+l);
          }
          </script>

          //VBScript
          <script language="VBScript"><!--
          function getIE()
          dim t,l,a,b
          set a=document.all.img1
          t=document.all.img1.offsetTop
          l=document.all.img1.offsetLeft
          while a.tagName<>"BODY"
          set a = a.offsetParent
          t=t+a.offsetTop
          l=l+a.offsetLeft
          wend
          msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"
          end function
          --></script>

          14. 光標(biāo)是停在文本框文字的最后
          <script language="javascript">
          function cc()
          {
          var e = event.srcElement;
          var r =e.createTextRange();
          r.moveStart('character',e.value.length);
          r.collapse(true);
          r.select();
          }
          </script>
          <input type=text name=text1 value="123" onfocus="cc()">

          15. 判斷上一頁(yè)的來(lái)源
          asp:
          request.servervariables("HTTP_REFERER")

          javascript:
          document.referrer

          16. 最小化、最大化、關(guān)閉窗口
          <object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
          <param name="Command" value="Minimize"></object>
          <object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
          <param name="Command" value="Maximize"></object>
          <OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
          <PARAM NAME="Command" value="Close"></OBJECT>

          <input type=button value=最小化 onclick=hh1.Click()>
          <input type=button value=最大化 onclick=hh2.Click()>
          <input type=button value=關(guān)閉 onclick=hh3.Click()>
          本例適用于IE

          17.
          <%
          '定義數(shù)據(jù)庫(kù)連接的一些常量
          Const adOpenForwardOnly = 0 '游標(biāo)只向前瀏覽記錄,不支持分頁(yè)、Recordset、BookMark
          Const adOpenKeyset = 1 '鍵集游標(biāo),其他用戶對(duì)記錄說(shuō)做的修改將反映到記錄集中,但其他用戶增加或刪除記錄不會(huì)反映到記錄集中。支持分頁(yè)、Recordset、BookMark
          Const adOpenDynamic = 2 '動(dòng)態(tài)游標(biāo)功能最強(qiáng),但耗資源也最多。用戶對(duì)記錄說(shuō)做的修改,增加或刪除記錄都將反映到記錄集中。支持全功能瀏覽(ACCESS不支持)。
          Const adOpenStatic = 3 '靜態(tài)游標(biāo),只是數(shù)據(jù)的一個(gè)快照,用戶對(duì)記錄說(shuō)做的修改,增加或刪除記錄都不會(huì)反映到記錄集中。支持向前或向后移動(dòng)

          Const adLockReadOnly = 1 '鎖定類型,默認(rèn)的,只讀,不能作任何修改
          Const adLockPessimistic = 2 '當(dāng)編輯時(shí)立即鎖定記錄,最安全的方式
          Const adLockOptimistic = 3 '只有在調(diào)用Update方法時(shí)才鎖定記錄集,而在此前的其他操作仍可對(duì)當(dāng)前記錄進(jìn)行更改、插入和刪除等
          Const adLockBatchOptimistic = 4 '當(dāng)編輯時(shí)記錄不會(huì)被鎖定,而更改、插入和刪除是在批處理方式下完成的

          Const adCmdText = &H0001
          Const adCmdTable = &H0002
          %>

          18. 網(wǎng)頁(yè)不會(huì)被緩存
          HTM網(wǎng)頁(yè)
          <META HTTP-EQUIV="pragma" CONTENT="no-cache">
          <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
          <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
          或者<META HTTP-EQUIV="expires" CONTENT="0">
          ASP網(wǎng)頁(yè)
          Response.Expires = -1
          Response.ExpiresAbsolute = Now() - 1
          Response.cachecontrol = "no-cache"
          PHP網(wǎng)頁(yè)
          header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
          header("Cache-Control: no-cache, must-revalidate");
          header("Pragma: no-cache");

          19. 檢查一段字符串是否全由數(shù)字組成
          <script language="javascript"><!--
          function checkNum(str){return str.match(/\D/)==null}
          alert(checkNum("1232142141"))
          alert(checkNum("123214214a1"))
          // --></script>

          20. 獲得一個(gè)窗口的大小
          document.body.clientWidth,document.body.clientHeight

          21. 怎么判斷是否是字符
          if (/[^\x00-\xff]/g.test(s)) alert("含有漢字");
          else alert("全是字符");

          22.TEXTAREA自適應(yīng)文字行數(shù)的多少
          <textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight">
          </textarea>

          23. 日期減去天數(shù)等于第二個(gè)日期
          <script language=javascript>
          function cc(dd,dadd)
          {
          //可以加上錯(cuò)誤處理
          var a = new Date(dd)
          a = a.valueOf()
          a = a - dadd * 24 * 60 * 60 * 1000
          a = new Date(a)
          alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日")
          }
          cc("12/23/2002",2)
          </script>

          24. 選擇了哪一個(gè)Radio
          <HTML><script language="vbscript">
          function checkme()
          for each ob in radio1
          if ob.checked then window.alert ob.value
          next
          end function
          </script><BODY>
          <INPUT name="radio1" type="radio" value="style" checked>Style
          <INPUT name="radio1" type="radio" value="barcode">Barcode
          <INPUT type="button" value="check" onclick="checkme()">
          </BODY></HTML>

          25.獲得本頁(yè)url的request.servervariables("")集合
          Response.Write "<TABLE border=1><!-- Table Header --><TR><TD><B>Variables</B></TD><TD><B>value</B></TD></TR>"
          for each ob in Request.ServerVariables
          Response.Write "<TR><TD>"&ob&"</TD><TD>"&Request.ServerVariables(ob)&"</TD></TR>"
          next
          Response.Write "</TABLE>"

          26.
          本機(jī)ip<%=request.servervariables("remote_addr")%>
          服務(wù)器名<%=Request.ServerVariables("SERVER_NAME")%>
          服務(wù)器IP<%=Request.ServerVariables("LOCAL_ADDR")%>
          服務(wù)器端口<%=Request.ServerVariables("SERVER_PORT")%>
          服務(wù)器時(shí)間<%=now%>
          IIS版本<%=Request.ServerVariables"SERVER_SOFTWARE")%>
          腳本超時(shí)時(shí)間<%=Server.ScriptTimeout%>
          本文件路徑<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%>
          服務(wù)器CPU數(shù)量<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>
          服務(wù)器解譯引擎<%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %>
          服務(wù)器操作系統(tǒng)<%=Request.ServerVariables("OS")%>

          27.ENTER鍵可以讓光標(biāo)移到下一個(gè)輸入框
          <input onkeydown="if(event.keyCode==13)event.keyCode=9">

          28. 檢測(cè)某個(gè)網(wǎng)站的鏈接速度:
          把如下代碼加入<body>區(qū)域中:
          <script language=javascript>
          tim=1
          setInterval("tim++",100)
          b=1

          var autourl=new Array()
          autourl[1]="autourl[2]="javacool.3322.net"
          autourl[3]="
          autourl[4]="autourl[5]="

          function butt(){
          document.write("<form name=autof>")
          for(var i=1;i<autourl.length;i++)
          document.write("<input type=text name=txt"+i+" size=10 value=測(cè)試中……> =》<input type=text name=url"+i+" size=40> =》<input type=button value=GO onclick=window.open(this.form.url"+i+".value)><br/>")
          document.write("<input type=submit value=刷新></form>")
          }
          butt()
          function auto(url){
          document.forms[0]["url"+b].value=url
          if(tim>200)
          {document.forms[0]["txt"+b].value="鏈接超時(shí)"}
          else
          {document.forms[0]["txt"+b].value="時(shí)間"+tim/10+"秒"}
          b++
          }
          function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl[i]+"/"+Math.random()+" width=1 height=1 onerror=auto('http://";+autourl[i]+"')>")}
          run()</script>

          29. 各種樣式的光標(biāo)
          auto :標(biāo)準(zhǔn)光標(biāo)
          default :標(biāo)準(zhǔn)箭頭
          hand :手形光標(biāo)
          wait :等待光標(biāo)
          text :I形光標(biāo)
          vertical-text :水平I形光標(biāo)
          no-drop :不可拖動(dòng)光標(biāo)
          not-allowed :無(wú)效光標(biāo)
          help :?幫助光標(biāo)
          all-scroll :三角方向標(biāo)
          move :移動(dòng)標(biāo)
          crosshair :十字標(biāo)
          e-resize
          n-resize
          nw-resize
          w-resize
          s-resize
          se-resize
          sw-resize

          ?


          1.本地?zé)o緩存,每次自動(dòng)刷新
          response.expires=0
          response.addHeader pragma , no-cache
          response.addHeader cache-control , private

          2.修改contentType并下載gif等格式
          <%
          function dl(f,n)
          on error resume next

          set s=CreateObject(Adodb.Stream)
          S.Mode=3
          S.Type=1
          S.Open
          s.LoadFromFile(server.mappath(f))
          if err.number>0 then
          ? response.write err.number & : & err.description
          else
          ? response.contentType=application/x-gzip
          ? response.addheader Content-Disposition:,attachment; filename= & n
          ? response.binarywrite(s.Read(s.size))
          end if
          end function

          call dl(012922501.gif,t1.gif)
          %>

          ?

          1。忽視右鍵
           <body oncontextmenu="return false">
           或
           <body style="overflow-y:hidden">
          2。加入背景音樂(lè)
           IE:<bgsound src="*.mid" loop=infinite>
           NS:<embed src="*.mid" autostart=true hidden=true loop=true>
           </embed>
           *.mid你的背景音樂(lè)的midi格式文件
          3。簡(jiǎn)單的window.open方法
           <a href="#"
           onclick="javascript:window.open(文件路徑/文件名,newwindow,
           toolbar=no,scrollbars=yes,resizable=no,top=0,left=0,
           width=400,height=300);">文字或圖片</a>
           參數(shù)解釋:
           <SCRIPT LANGUAGE="javascript"> js腳本開始;
           window.open 彈出新窗口的命令;
           文件路徑/文件名 彈出窗口的文件名;
           newwindow 彈出窗口的名字(不是文件名),非必須,可用空代替;
           width=400 窗口寬度;
           height=300 窗口高度;
           top=0 窗口距離屏幕上方的象素值;
           left=0 窗口距離屏幕左側(cè)的象素值;
           toolbar=no 是否顯示工具欄,yes為顯示;
           menubar,scrollbars 表示菜單欄和滾動(dòng)欄。
           resizable=no 是否允許改變窗口大小,yes為允許;
           location=no 是否顯示地址欄,yes為允許;
           status=no 是否顯示狀態(tài)欄內(nèi)的信息(通常是文件已經(jīng)打開),yes為允許;
           </SCRIPT> js腳本結(jié)束
          4。簡(jiǎn)單的頁(yè)面加密
           <script LANGUAGE="javascript">
           <!--
           function loopy(){
            var sWord ="";
            while(sWord!="login"){sWord=prompt("請(qǐng)輸入你的登陸密碼");}
            alert("登陸成功!");
           }
           loopy()
           //-->
           </script>
          5。拉動(dòng)頁(yè)面時(shí)背景圖不動(dòng)
           <style>
           body{background-image:url(logo.gif);
           background-repeat:no-repeat;background-position:center}
           </style>
          7。隨機(jī)替換圖片
           <script>
           document.write(<img src="img/+parseInt(Math.random()*(5))
           +.gif"height="40" width="50">)
           </script>
           圖片文件名為0.gif 1.gif 2.gif 3.gif 4.gif
          8。窗口定時(shí)關(guān)閉
           先將如下代碼網(wǎng)頁(yè)文件的區(qū):
           <script language="javascript">
           function closeit() { setTimeout("self.close()",10000) //毫秒 }
           </script>
           然后再在<body>標(biāo)內(nèi)加入如:<body onload="closeit()">
          9。網(wǎng)頁(yè)自動(dòng)關(guān)閉
           <html>
           <head>
           <object id=closes type="application/x-oleobject"
           classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
           <param name="Command" value="Close">
           </object>
           </head>
           <body onload="window.setTimeout(closes.Click(),10000)">
           這個(gè)窗口會(huì)在10秒過(guò)后自動(dòng)關(guān)閉,而且不會(huì)出現(xiàn)提示.
           </body>
           </html>
          10。網(wǎng)頁(yè)自動(dòng)刷新
           在head部記入
           <META HTTP-EQUIV="Refresh" content="20">
           其中20為20秒后自動(dòng)刷新,你可以更改為任意值。
          11。網(wǎng)頁(yè)自動(dòng)轉(zhuǎn)頁(yè)
           <META HTTP-EQUIV="Refresh" CONTENT="時(shí)間(秒);URL=地址">
          12。保持layer在最前面,而不被Iframe、Object所覆蓋
           在Layer中再插Iframe 或 Object 設(shè)z-Index值
           <div z-Index:2><object xxx></object> # 前面
           <div z-Index:1><object xxx></object> # 后面
           <div id="Layer2" style="position:absolute; top:40;width:400px;
           height:95px;z-index:2"> height=100% width=100%>
           <iframe width=0 height=0></iframe>
           </div>
           <div id="Layer1" style="position:absolute; top:50;width:200px;
           height:115px;z-index:1">
           <iframe height=100% width=100%></iframe>
           </div>
          13。返回上一頁(yè)
           <a href=javascript:history.back(1)>『返回上一頁(yè)』</a>
          14。關(guān)閉窗口
           <a href=javascript:self.close()>『關(guān)閉窗口』</a>
          15。關(guān)于iframe的透明背景
           <IFRAME ID="iFrame1" SRC="iframe.htm"
           allowTransparency="true"
           style="background-color: green"></IFRAME>

          ?


          1.如何用Asp判斷你的網(wǎng)站的虛擬物理路徑
          答:使用Mappath方法
          < p align="center" >< font size="4" face="Arial" >< b >
          The Physical path to this virtual website is:
          < /b >< /font >
          < font color="#FF0000" size="6" face="Arial" >
          < %= Server.MapPath("\")% >
          < /font >< /p >
          2.我如何知道使用者所用的瀏覽器?
          答:使用the Request object方法
          strBrowser=Request.ServerVariables("HTTP_USER_AGENT")
          If Instr(strBrowser,"MSIE") < > 0 Then
            Response.redirect("ForMSIEOnly.htm")
          Else
            Response.redirect("ForAll.htm")
          End If

          3.如何計(jì)算每天的平均反復(fù)訪問(wèn)人數(shù)
          答:解決方法
          < % startdate=DateDiff("d",Now,"01/01/1990")
          if strdate< 0 then startdate=startdate*-1
          avgvpd=Int((usercnt)/startdate) % >
          顯示結(jié)果
          < % response.write(avgvpd) % >
          that is it.this page have been viewed since November 10,1998

          4.如何顯示隨機(jī)圖象
          < % dim p,ppic,dpic
          ppic=12
          randomize
          p=Int((ppic*rnd)+1)
          dpic="graphix/randompics/"&p&".gif"
          % >
          顯示
          < img src="< %=dpic% >" >

          5.如何回到先前的頁(yè)面
          答:< a href="< %=request.serverVariables("Http_REFERER")% >" >preivous page< /a >
          或用圖片如:< img src="arrowback.gif" alt="< %=request.serverVariables("HTTP_REFERER")% >" >

          6.如何確定對(duì)方的IP地址
          答:< %=Request.serverVariables("REMOTE_ADDR)% >

          7.如何鏈結(jié)到一副圖片上
          答:< % @Languages=vb-script % >
          < % response.expires=0
          strimagename="graphix/errors/erroriamge.gif"
          response.redirect(strimagename)
          % >

          8.強(qiáng)迫輸入密碼對(duì)話框
          答:把這句話放載頁(yè)面的開頭
          < % response.status="401 not Authorized"
          response.end
          % >

          9.如何傳遞變量從一頁(yè)到另一頁(yè)
          答:用 HIDDEN 類型來(lái)傳遞變量
          < % form method="post" action="mynextpage.asp" >
          < % for each item in request.form % >
          < input namee="< %=item% >" type="HIDDEN"
          value="< %=server.HTMLEncode(Request.form(item)) % >" >
          < % next % >
          < /form >

          10.為何我在 asp 程序內(nèi)使用 msgbox,程序出錯(cuò)說(shuō)沒(méi)有權(quán)限
          答:由于 asp 是服務(wù)器運(yùn)行的,如果可以在服務(wù)器顯示一個(gè)對(duì)話框,那么你只好等有人按了確定之后,你的程序才能繼續(xù)執(zhí)行,而一般服務(wù)器不會(huì)有人守著,所以微軟不得不禁止這個(gè)函數(shù),并胡亂告訴你 (:) 呵呵) 沒(méi)有權(quán)限。但是ASP和客戶端腳本結(jié)合倒可以顯示一個(gè)對(duì)話框,as follows:
          < % yourVar="測(cè)試對(duì)話框"% >
          < % script language='java-script' >
          alert("< %=yourvar% >")
          < /script >

          11.有沒(méi)有辦法保護(hù)自己的源代碼,不給人看到
          答:可以去下載一個(gè)微軟的Windows Script Encoder,它可以對(duì)asp的腳本和客戶端java-script/vb-script腳本進(jìn)行加密。。。不過(guò)客戶端加密后,只有ie5才能執(zhí)行,服務(wù)器端腳本加密后,只有服務(wù)器上安裝有script engine 5(裝一個(gè)ie5就有了)才能執(zhí)行。

          12.怎樣才能將 query string 從一個(gè) asp 文件傳送到另一個(gè)?
          答:前者文件加入下句: Response.Redirect("second.asp?" & Request.ServerVariables("QUERY_STRING"))

          13.global.asa文件總是不起作用?
          答:只有web目錄設(shè)置為web application, global.asa才有效,并且一個(gè)web application的根目錄下 global.asa才有效。IIS4可以使用Internet Service Manager設(shè)置application setting 怎樣才能使得htm文件如同asp文件一樣可以執(zhí)行腳本代碼?

          14.怎樣才能使得htm文件如同asp文件一樣可以執(zhí)行腳本代碼?
          答:Internet Sevices Manager - > 選擇default web site - >右鼠鍵- >菜單屬性-〉主目錄- > 應(yīng)用程序設(shè)置(Application Setting)- > 點(diǎn)擊按鈕 "配置"- > app mapping - >點(diǎn)擊按鈕"Add" - > executable browse選擇 \WINNT\SYSTEM32\INETSRV\ASP.DLL EXTENSION 輸入 htm method exclusions 輸入PUT.DELETE 全部確定即可。但是值得注意的是這樣對(duì)htm也要由asp.dll處理,效率將降低。

          15.如何注冊(cè)組件
          答:有兩種方法。
          第一種方法:手工注冊(cè) DLL 這種方法從IIs 3.0一直使用到IIs 4.0和其它的Web Server。它需要你在命令行方式下來(lái)執(zhí)行,進(jìn)入到包含有DLL的目錄,并輸入:regsvr32 component_name.dll 例如 c:\temp\regsvr32 AspEmail.dll 它會(huì)把dll的特定信息注冊(cè)入服務(wù)器中的注冊(cè)表中。然后這個(gè)組件就可以在服務(wù)器上使用了,但是這個(gè)方法有一個(gè)缺陷。當(dāng)使用這種方法注冊(cè)完畢組件后,該組件必須要相應(yīng)的設(shè)置NT的匿名帳號(hào)有權(quán)限執(zhí)行這個(gè)dll。特別是一些組件需要讀取注冊(cè)表,所以,這個(gè)注冊(cè)組件的方法僅僅是使用在服務(wù)器上沒(méi)有MTS的情況下,要取消注冊(cè)這個(gè)dll,使用:regsvr32 /u aspobject.dll example c:\temp\regsvr32 /u aneiodbc.dll

          第二種方法:使用MTS(Microsoft Transaction Server) MTS是IIS 4新增特色,但是它提供了巨大的改進(jìn)。MTS允許你指定只有有特權(quán)的用戶才能夠訪問(wèn)組件,大大提高了網(wǎng)站服務(wù)器上的安全性設(shè)置。在MTS上注冊(cè)組件的步驟如下:
          1) 打開IIS管理控制臺(tái)。
          2) 展開transaction server,右鍵單擊"pkgs installed"然后選擇"new package"。
          3) 單擊"create an empty package"。
          4) 給該包命名。
          5) 指定administrator帳號(hào)或則使用"interactive"(如果服務(wù)器經(jīng)常是使用administrator 登陸的話)。
          6) 現(xiàn)在使用右鍵單擊你剛建立的那個(gè)包下面展開后的"components"。選擇 "new then component"。
          7) 選擇 "install new component" [b]。
          8) 找到你的.dll文件然后選擇next到完成。
          要?jiǎng)h除這個(gè)對(duì)象,只要選擇它的圖標(biāo),然后選擇delete。
          附注:特別要注意第二種方法,它是用來(lái)調(diào)試自己編寫組件的最好方法,而不必每次都需要重新啟動(dòng)機(jī)器了。

          16. ASP與Access數(shù)據(jù)庫(kù)連接:

          <%@ language=vb-script%>
          <%
          dim conn,mdbfile
          mdbfile=server.mappath("數(shù)據(jù)庫(kù)名稱.mdb")
          set conn=server.createobject("adodb.connection")
          conn.open "driver={microsoft access driver (*.mdb)};uid=admin;pwd=數(shù)據(jù)庫(kù)密碼;dbq="&mdbfile

          %>

          17. ASP與SQL數(shù)據(jù)庫(kù)連接:

          <%@ language=vb-script%>
          <%
          dim conn
          set conn=server.createobject("ADODB.connection")
          con.open "PROVIDER=SQLOLEDB;DATA SOURCE=SQL服務(wù)器名稱或IP地址;UID=sa;PWD=數(shù)據(jù)庫(kù)密碼;DATABASE=數(shù)據(jù)庫(kù)名稱
          %>

          建立記錄集對(duì)象:

          set rs=server.createobject("adodb.recordset")
          rs.open SQL語(yǔ)句,conn,3,2

          ?


            3、頁(yè)面摘入等待。。。。腳本說(shuō)明:
            把如下代碼加入<head>區(qū)域中
            <SCRIPT LANGUAGE="JavaScript">
            document.write("<font size=6 color=blue face='楷體_GB2312'><B>正在載入首頁(yè),請(qǐng)稍等..</B></font>");
            window.clear;
            window.location.href="
            </SCRIPT>

            4、在Text直接修改記錄,然后點(diǎn)修改保存記錄
            <%count=0
            do while not (rs.eof or rs.bof) and count<rs.PageSize %>
            <form action="webGroupEdit.asp" method="post" name="GroupEdit" onSubmit="return Checkedit()">
            <tr bgcolor="E9F3FF">
            <td>&nbsp;<%=rs("id")%> <input name="b" type="hidden" id="b" value="<%=rs("id")%>">
            <input name="currpage" type="hidden" id="currpage" value="<%=page%>"></td>
            <td height="18"><input name="a" type="text" id="a" value="<%=rs("MemGroupName")%>" size="20" maxlength="50">
            </td>
            <td height="18"><input name="c" type="text" id="c" value="<%=rs("Remark")%>" size="25" maxlength="30"></td>
            <td><input type="submit" name="Submit" value=" 修改 " ></td>
            <td><div align="center"><a href="webGroupDel.asp?id=<%=rs("id")%>&page=<%=page%>" onClick="return check()">刪除</a></div></td>
            </tr>
            </form>
            <%
            count=count+1
            rs.movenext
            loop
            %>

            5、自動(dòng)計(jì)算問(wèn)題:
            <input type="hidden" name="selvalue">
            <SELECT NAME="select1" onChage="javascript:document.form1.selvalue.value=this.options[this.options.selectedIndex].text">
            <option value="1">新浪</option>
            <option value="2">百度</option>
            <option value="3">中華網(wǎng)</option>
            <option value="4">騰訊</option>
            </SELECT>

          ?


          <SCRIPT LANGUAGE="javascript"> js腳本開始;
            window.open 彈出新窗口的命令;
            'page.html' 彈出窗口的文件名;
            'newwindow' 彈出窗口的名字(不是文件名),非必須,可用空''代替;
            height=100 窗口高度;
            width=400 窗口寬度;
            top=0 窗口距離屏幕上方的象素值;
            left=0 窗口距離屏幕左側(cè)的象素值;
            toolbar=no 是否顯示工具欄,yes為顯示;
            menubar,scrollbars 表示菜單欄和滾動(dòng)欄。
            resizable=no 是否允許改變窗口大小,yes為允許;
            location=no 是否顯示地址欄,yes為允許;
            status=no 是否顯示狀態(tài)欄內(nèi)的信息(通常是文件已經(jīng)打開),yes為允許;
            </SCRIPT> js腳本結(jié)束
          ?
          判斷星期幾

          <%
          yue=month(date())
          nian=year(date())
          thismon=nian&"-"&yue&"-1"
          nextmon=dateadd("m",1,thismon)
          tiancount=datediff("d",thismon,nextmon)? '本月的天數(shù)

          wek= Weekday(date())
          select case wek
          case 1
          response.write "周日"
          case 2
          response.write "周一"
          case 3
          response.write "周二"
          case 4
          response.write "周三"
          case 5
          response.write "周四"
          case 6
          response.write "周五"
          case 7
          response.write "周六"
          end select

          yue=month(date())
          nian=year(date())
          thismon=nian&"-"&yue&"-1"
          nextmon=dateadd("m",1,thismon)
          tiancount=datediff("d",thismon,nextmon)? '本月的天數(shù)
          dim wek,wekday
          wek= Weekday(date())
          select case wek
          case 1
          wekday= "周日"
          case 2
          wekday= "周一"
          case 3
          wekday= "周二"
          case 4
          wekday= "周三"
          case 5
          wekday= "周四"
          case 6
          wekday= "周五"
          case 7
          wekday= "周六"
          end select

          'response.write "本月共"&tiancount&"天,今天是"&wekday&"
          %>

          主站蜘蛛池模板: 津南区| 昌邑市| 新津县| 朝阳县| 将乐县| 石渠县| 博湖县| 会理县| 香港 | 射阳县| 资讯 | 迁安市| 沭阳县| 卢龙县| 安宁市| 安丘市| 平利县| 东港市| 绵阳市| 五寨县| 招远市| 中卫市| 罗源县| 丹寨县| 万全县| 乐清市| 江永县| 新田县| 鄂尔多斯市| 淳化县| 宣化县| 九江县| 松原市| 武夷山市| 兴业县| 邹平县| 武穴市| 青冈县| 松原市| 桐梓县| 集贤县|