隨筆-179  評論-666  文章-29  trackbacks-0

          名稱: 使網頁自動定時刷新

          實例: 本頁自動定時刷新

          代碼: 將以下代碼加入html<head></head>之間<br>

           

          <:  meta http-equiv="refresh" content="10; url=你想訪問的網址"> <br>

           

          說明: 其中10代表當前頁完全下載完成10秒后自動鏈接到指定的url,把url去掉就表示每隔10秒自動刷新一次主頁。  <br>

           

           

          ''驗證合法email地址: <br>

           

          function isvalidemail(email)

          dim names, name, i, c

          isvalidemail = true

          names = split(email, "@")

          if ubound(names) <> 1 then

            isvalidemail = false

            exit function

          end if

          for each name in names

            if len(name) <= 0 then

              isvalidemail = false

              exit function

            end if

            for i = 1 to len(name)

              c = lcase(mid(name, i, 1))

              if instr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not isnumeric(c) then

                isvalidemail = false

                exit function

              end if

            next

            if left(name, 1) = "." or right(name, 1) = "." then

               isvalidemail = false

               exit function

            end if

          next

          if instr(names(1), ".") <= 0 then

            isvalidemail = false

            exit function

          end if

          i = len(names(1)) - instrrev(names(1), ".")

          if i <> 2 and i <> 3 then

            isvalidemail = false

            exit function

          end if

          if instr(email, "..") > 0 then

            isvalidemail = false

          end if

          end function

           

          %>

           

           

           

          16.使用fso修改文件特定內容的函數

          function fsochange(filename,target,string)

          dim objfso,objcountfile,filetempdata

          set objfso = server.createobject("scripting.filesystemobject")

          set objcountfile = objfso.opentextfile(server.mappath(filename),1,true)

          filetempdata = objcountfile.readall

          objcountfile.close

          filetempdata=replace(filetempdata,target,string)

          set objcountfile=objfso.createtextfile(server.mappath(filename),true)

          objcountfile.write filetempdata

          objcountfile.close

          set objcountfile=nothing

          set objfso = nothing

          end function

           

           

          17.使用fso讀取文件內容的函數

          function fsofileread(filename)

          dim objfso,objcountfile,filetempdata

          set objfso = server.createobject("scripting.filesystemobject")

          set objcountfile = objfso.opentextfile(server.mappath(filename),1,true)

          fsofileread = objcountfile.readall

          objcountfile.close

          set objcountfile=nothing

          set objfso = nothing

          end function

           

           

          18.使用fso讀取文件某一行的函數

          function fsolinedit(filename,linenum)

          if linenum < 1 then exit function

          dim fso,f,temparray,tempcnt

          set fso = server.createobject("scripting.filesystemobject")

          if not fso.fileexists(server.mappath(filename)) then exit function

          set f = fso.opentextfile(server.mappath(filename),1)

          if not f.atendofstream then

          tempcnt = f.readall

          f.close

          set f = nothing

          temparray = split(tempcnt,chr(13)&chr(10))

          if linenum>ubound(temparray)+1 then

           exit function

          else

           fsolinedit = temparray(linenum-1)

          end if

          end if

          end function

           

           

           

          19.使用fso寫文件某一行的函數

          function fsolinewrite(filename,linenum,linecontent)

          if linenum < 1 then exit function

          dim fso,f,temparray,tempcnt

          set fso = server.createobject("scripting.filesystemobject")

          if not fso.fileexists(server.mappath(filename)) then exit function

          set f = fso.opentextfile(server.mappath(filename),1)

          if not f.atendofstream then

          tempcnt = f.readall

          f.close

          temparray = split(tempcnt,chr(13)&chr(10))

          if linenum>ubound(temparray)+1 then

           exit function

          else

           temparray(linenum-1) = linecontent

          end if

          tempcnt = join(temparray,chr(13)&chr(10))

          set f = fso.createtextfile(server.mappath(filename),true)

          f.write tempcnt

          end if

          f.close

          set f = nothing

          end function

           

           

           

          20.使用fso添加文件新行的函數

          function fsoappline(filename,linecontent)

          dim fso,f

          set fso = server.createobject("scripting.filesystemobject")

          if not fso.fileexists(server.mappath(filename)) then exit function

          set f = fso.opentextfile(server.mappath(filename),8,1)

          f.write chr(13)&chr(10)&linecontent

          f.close

          set f = nothing

          end function

           

           

           

          21.讀文件最后一行的函數

          function fsolastline(filename)

          dim fso,f,temparray,tempcnt

          set fso = server.createobject("scripting.filesystemobject")

          if not fso.fileexists(server.mappath(filename)) then exit function

          set f = fso.opentextfile(server.mappath(filename),1)

          if not f.atendofstream then

          tempcnt = f.readall

          f.close

          set f = nothing

          temparray = split(tempcnt,chr(13)&chr(10))

           fsolastline = temparray(ubound(temparray))

          end if

          end function

           

           

          [推薦]利用fso取得bmpjpgpnggif文件信息(大小,寬、高等)

          <%

             ':::      bmp,  gif,  jpg  and  png                                                                          :::

           

             ':::    this  function  gets  a  specified  number  of  bytes  from  any        :::

             ':::    file,  starting  at  the  offset  (base  1)                                            :::

             ':::                                                                                                                          :::

             ':::    passed:                                                                                                        :::

             ':::              flnm                =>  filespec  of  file  to  read                              :::

             ':::              offset            =>  offset  at  which  to  start  reading              :::

             ':::              bytes              =>  how  many  bytes  to  read                                  :::

             ':::                                                                                                                          :::

             ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

           

           

             function  getbytes(flnm,  offset,  bytes)

                   dim  objfso

                   dim  objftemp

                   dim  objtextstream

                   dim  lngsize

                   on  error  resume  next

                   set  objfso  =  createobject("scripting.filesystemobject")

                   

                   '  first,  we  get  the  filesize

                   set  objftemp  =  objfso.getfile(flnm)

                   lngsize  =  objftemp.size

                   set  objftemp  =  nothing

                   fsoforreading  =  1

                   set  objtextstream  =  objfso.opentextfile(flnm,  fsoforreading)

                   if  offset  >  0  then

                         strbuff  =  objtextstream.read(offset  -  1)

                   end  if

                   if  bytes  =  -1  then                  '  get  all!

                         getbytes  =  objtextstream.read(lngsize)    'readall

                   else

                         getbytes  =  objtextstream.read(bytes)

                   end  if

                   objtextstream.close

                   set  objtextstream  =  nothing

                   set  objfso  =  nothing

             end  function

           

             ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

             ':::                                                                                                                          :::

             ':::    functions  to  convert  two  bytes  to  a  numeric  value  (long)      :::

             ':::    (both  little-endian  and  big-endian)                                                :::

             ':::                                                                                                                          :::

             ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

           

           

             function  lngconvert(strtemp)

                   lngconvert  =  clng(asc(left(strtemp,  1))  +  ((asc(right(strtemp,  1))  *  256)))

             end  function

             function  lngconvert2(strtemp)

                   lngconvert2  =  clng(asc(right(strtemp,  1))  +  ((asc(left(strtemp,  1))  *  256)))

             end  function

           

           

             

             ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

             ':::                                                                                                                          :::

             ':::    this  function  does  most  of  the  real  work.  it  will  attempt    :::

             ':::    to  read  any  file,  regardless  of  the  extension,  and  will        :::

             ':::    identify  if  it  is  a  graphical  image.                                              :::

             ':::                                                                                                                          :::

             ':::    passed:                                                                                                        :::

             ':::              flnm                =>  filespec  of  file  to  read                              :::

             ':::              width              =>  width  of  image                                                  :::

             ':::              height            =>  height  of  image                                                :::

             ':::              depth              =>  color  depth  (in  number  of  colors)            :::

             ':::              strimagetype=>  type  of  image  (e.g.  gif,  bmp,  etc.)        :::

             ':::                                                                                                                          :::

             ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

           

           

           

             function  gfxspex(flnm,  width,  height,  depth,  strimagetype)

                   dim  strpng  

                   dim  strgif

                   dim  strbmp

                   dim  strtype

                   strtype  =  ""

                   strimagetype  =  "(unknown)"

                   gfxspex  =  false

                   strpng  =  chr(137)  &  chr(80)  &  chr(78)

                   strgif  =  "gif"

                   strbmp  =  chr(66)  &  chr(77)

                   strtype  =  getbytes(flnm,  0,  3)

                   if  strtype  =  strgif  then                                                      '  is  gif

                         strimagetype  =  "gif"

                         width  =  lngconvert(getbytes(flnm,  7,  2))

                         height  =  lngconvert(getbytes(flnm,  9,  2))

                         depth  =  2  ^  ((asc(getbytes(flnm,  11,  1))  and  7)  +  1)

                         gfxspex  =  true

                   elseif  left(strtype,  2)  =  strbmp  then                            '  is  bmp

                         strimagetype  =  "bmp"

                         width  =  lngconvert(getbytes(flnm,  19,  2))

                         height  =  lngconvert(getbytes(flnm,  23,  2))

                         depth  =  2  ^  (asc(getbytes(flnm,  29,  1)))

                         gfxspex  =  true

                   elseif  strtype  =  strpng  then                                              '  is  png

                         strimagetype  =  "png"

                         width  =  lngconvert2(getbytes(flnm,  19,  2))

                         height  =  lngconvert2(getbytes(flnm,  23,  2))

                         depth  =  getbytes(flnm,  25,  2)

                         select  case  asc(right(depth,1))

                               case  0

                                     depth  =  2  ^  (asc(left(depth,  1)))

                                     gfxspex  =  true

                               case  2

                                     depth  =  2  ^  (asc(left(depth,  1))  *  3)

                                     gfxspex  =  true

                               case  3

                                     depth  =  2  ^  (asc(left(depth,  1)))    '8

                                     gfxspex  =  true

                               case  4

                                     depth  =  2  ^  (asc(left(depth,  1))  *  2)

                                     gfxspex  =  true

                               case  6

                                     depth  =  2  ^  (asc(left(depth,  1))  *  4)

                                     gfxspex  =  true

                               case  else

                                     depth  =  -1

                         end  select

                   else

                         strbuff  =  getbytes(flnm,  0,  -1)                  '  get  all  bytes  from  file

                         lngsize  =  len(strbuff)

                         flgfound  =  0

                         strtarget  =  chr(255)  &  chr(216)  &  chr(255)

                         flgfound  =  instr(strbuff,  strtarget)

                         if  flgfound  =  0  then

                               exit  function

                         end  if

                         strimagetype  =  "jpg"

                         lngpos  =  flgfound  +  2

                         exitloop  =  false

                         do  while  exitloop  =  false  and  lngpos  <  lngsize

                               do  while  asc(mid(strbuff,  lngpos,  1))  =  255  and  lngpos  <  lngsize

                                     lngpos  =  lngpos  +  1

                               loop

                               if  asc(mid(strbuff,  lngpos,  1))  <  192  or  asc(mid(strbuff,  lngpos,  1))  >  195  then

                                     lngmarkersize  =  lngconvert2(mid(strbuff,  lngpos  +  1,  2))

                                     lngpos  =  lngpos  +  lngmarkersize    +  1

                               else

                                     exitloop  =  true

                               end  if

                       loop

                       '

                       if  exitloop  =  false  then

                             width  =  -1

                             height  =  -1

                             depth  =  -1

                       else

                             height  =  lngconvert2(mid(strbuff,  lngpos  +  4,  2))

                             width  =  lngconvert2(mid(strbuff,  lngpos  +  6,  2))

                             depth  =  2  ^  (asc(mid(strbuff,  lngpos  +  8,  1))  *  

                             gfxspex  =  true

                       end  if

                                               

                   end  if

             end  function

           

           

             ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

             ':::          test  harness                                                  :::

             ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

             

             '  to  test,  we'll  just  try  to  show  all  files  with  a  .gif  extension  in  the  root  of  c:

             set  objfso  =  createobject("scripting.filesystemobject")

             set  objf  =  objfso.getfolder("c:\")

             set  objfc  =  objf.files

             response.write  "<table  border=""0""  cellpadding=""5"">"

             for  each  f1  in  objfc

                 if  instr(ucase(f1.name),  ".gif")  then

                       response.write  "<tr><td>"  &  f1.name  &  "</td><td>"  &  f1.datecreated  &  "</td><td>"  &  f1.size  &  "</td><td>"

                       if  gfxspex(f1.path,  w,  h,  c,  strtype)  =  true  then

                             response.write  w  &  "  x  "  &  h  &  "  "  &  c  &  "  colors"

                       else

                             response.write  "  "

                       end  if

                       response.write  "</td></tr>"

                 end  if

             next

             response.write  "</table>"

             set  objfc  =  nothing

             set  objf  =  nothing

             set  objfso  =  nothing

          %>

           

           

          24.點擊返回上頁代碼:

          <form>

           <p><:  input type="button" value="返回上一步" onclick="history.back(-1)"></p>

          </form>

           

           

           

          24.點擊刷新代碼:

          <form>

           <p><:   input type="button" value="刷新按鈕一" onclick="reloadbutton()"></p>

          </form>

          <script language="javascript"><!--

          function reloadbutton(){location.href="allbutton.htm";}

          // --></script>

           

           

          24.點擊刷新代碼2:

          <form>

           <p><:  input type="button" value="刷新按鈕二" onclick="history.go(0)"> </p>

          </form>

           

          <form>

           <p><:  input type="button" value="打開一個網站" onclick="homebutton()"></p>

          </form>

           

           

           

          <script language="javascript"><!--

          function homebutton(){location.href=" http://nettrain.126.com";;}

          // --></script>  

           

           

           

          25.彈出警告框代碼:

          <form>

           <p><:   input type="button" value="彈出警告框" onclick="alertbutton()"></p>

          </form>

          <:  script language="javascript"><!--

          function alertbutton(){window.alert("要多多光臨呀!");}

          // --></script>

           

           

           

          26.狀態欄信息

          <form>

           <p><:   input type="button" value="狀態欄信息" onclick="statusbutton()"></p>

          </form>

          <:   script language="javascript"><!--

          function statusbutton(){window.status="要多多光臨呀!";}

          // --></script>

           

           

          27.背景色變換

          <form>

           <p><:  input type="button" value="背景色變換" onclick="bgbutton()"></p>

          </form>

          <:   script>function bgbutton(){

          if (document.bgcolor=='#00ffff')

             {document.bgcolor='#ffffff';}

          else{document.bgcolor='#00ffff';}

          }

          </script>

           

           

          28.點擊打開新窗口

          <form>

           <p><:   input type="button" value="打開新窗口" onclick="newwindow()"></p>

          </form>

          <:    script language="javascript"><!--

          function newwindow(){window.open(" http://www.mcmx.com";,"","height=240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no");}

          // --></script></body>

           

           

          29.分頁代碼:

          <%''本程序文件名為:pages.asp%>

          <%''包含ado常量表文件adovbs.inc,可從"\program files\common files\system\ado"目錄下拷貝%>

          <!--#include file="adovbs.inc"-->

          <%''*建立數據庫連接,這里是oracle8.05數據庫

          set conn=server.createobject("adodb.connection")  

          conn.open "provider=msdaora.1;data source=yoursrcname;user id=youruserid;password=yourpassword;"  

          set rs=server.createobject("adodb.recordset")   ''創建recordset對象

          rs.cursorlocation=aduseclient                   ''設定記錄集指針屬性

          ''*設定一頁內的記錄總數,可根據需要進行調整

          rs.pagesize=10                                    

          ''*設置查詢語句    

          strsql="select id,姓名,住址,電話 from 通訊錄 order by id"        

          rs.open strsql,conn,adopenstatic,adlockreadonly,adcmdtext

          %>

          <html>

          <head>

          <title>分頁示例</title>

          <:   script language=javascript>

          //點擊"[第一頁]"時響應:

          function pagefirst()

          {

            document.myform.currentpage.selectedindex=0;

            document.myform.currentpage.onchange();

          }

          //點擊"[上一頁]"時響應:

          function pageprior()

          {    

            document.myform.currentpage.selectedindex--;

            document.myform.currentpage.onchange();

          }

          //點擊"[下一頁]"時響應:

          function pagenext()

          {

            document.myform.currentpage.selectedindex++;

            document.myform.currentpage.onchange();        

          }

          //點擊"[最后一頁]"時響應:

          function pagelast()

          {  

            document.myform.currentpage.selectedindex=document.myform.currentpage.length-1;

            document.myform.currentpage.onchange();

          }

          //選擇"第?頁"時響應:

          function pagecurrent()

          { //pages.asp是本程序的文件名

            document.myform.action='pages.asp?page='+(document.myform.currentpage.selectedindex+1)

            document.myform.submit();

          }  

          </script>

          </head>

          <body bgcolor="#ffffcc" link="#008000" vlink="#008000" alink="#ff0000"">

           

          <%if rs.eof then

            response.write("<font size=2 color=#000080>[數據庫中沒有記錄!]</font>")

          else  

            ''指定當前頁碼

            if request("currentpage")="" then

              rs.absolutepage=1

            else

              rs.absolutepage=clng(request("currentpage"))

            end if  

           

            ''創建表單myform,方法為get

            response.write("<form method=get name=myform>")  

            response.write("<p align=center><font size=2 color=#008000>")

            ''設置翻頁超鏈接

            if rs.pagecount=1 then  

              response.write("[第一頁] [上一頁] [下一頁] [最后一頁] ")

            else

                if rs.absolutepage=1 then

                  response.write("[第一頁] [上一頁] ")

                  response.write("[<: href=javascript:pagenext()>下一頁</a>] ")

                  response.write("[<: href=javascript:pagelast()>最后一頁</a>] ")

                else

                    if rs.absolutepage=rs.pagecount then

                      response.write("[<: href=javascript:pagefirst()>第一頁</a>] ")

                      response.write("[<: href=javascript:pageprior()>上一頁</a>] ")

                      response.write("[下一頁] [最后一頁] ")

                    else

                        response.write("[<: href=javascript:pagefirst()>第一頁</a>] ")

                        response.write("[<: href=javascript:pageprior()>上一頁</a>] ")

                        response.write("[<: href=javascript:pagenext()>下一頁</a>] ")

                        response.write("[<: href=javascript:pagelast()>最后一頁</a>] ")

                    end if

                end if

            end if

           

           

           

            ''創建下拉列表框,用于選擇瀏覽頁碼

            response.write("<select size=1 name=currentpage onchange=pagecurrent()>")    

            for i=1 to rs.pagecount

              if rs.absolutepage=i then

                 response.write("<option selected>"&i&"</option>")  ''當前頁碼

              else

                 response.write("<option>"&i&"</option>")

              end if  

            next

            response.write("</select>/"&rs.pagecount&" "&rs.recordcount&"條記錄</font><p>")

            response.write("</form>")

           

           

            ''創建表格,用于顯示

            response.write("<table align=center cellspacing=1 cellpadding=1 border=1")    

            response.write(" bordercolor=#99ccff bordercolordark=#b0e0e6 bordercolorlight=#000066>")

           

            response.write("<tr bgcolor=#ccccff bordercolor=#000066>")

             

            set columns=rs.fields

           

           

           

            ''顯示表頭

            for i=0 to columns.count-1

              response.write("<td align=center width=200 height=13>")

              response.write("<font size=2><b>"&columns(i).name&"</b></font></td>")  

            next

            response.write("</tr>")

           

           

            ''顯示內容

            for i=1 to rs.pagesize

              response.write("<tr bgcolor=#99ccff bordercolor=#000066>")

              for j=0 to columns.count-1

                response.write("<td><font size=2>"&columns(j)&"</font></td>")

              next

              response.write("</tr>")

             

              rs.movenext

              if rs.eof then exit for

            next

           

            response.write("</table>")

          end if

          %>

          </body>

          </html>

           

           

           

          <%

          驗證合法email地址:

           

          function isvalidemail(email)

          dim names, name, i, c

          isvalidemail = true

          names = split(email, "@")

          if ubound(names) <> 1 then

            isvalidemail = false

            exit function

          end if

          for each name in names

            if len(name) <= 0 then

              isvalidemail = false

              exit function

            end if

            for i = 1 to len(name)

              c = lcase(mid(name, i, 1))

              if instr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not isnumeric(c) then

                isvalidemail = false

                exit function

              end if

            next

            if left(name, 1) = "." or right(name, 1) = "." then

               isvalidemail = false

               exit function

            end if

          next

          if instr(names(1), ".") <= 0 then

            isvalidemail = false

            exit function

          end if

          i = len(names(1)) - instrrev(names(1), ".")

          if i <> 2 and i <> 3 then

            isvalidemail = false

            exit function

          end if

          if instr(email, "..") > 0 then

            isvalidemail = false

          end if

          end function

          %>

           

           

           

          windows media player 播放器

          <:  object id=mediaplayer1

                     style="left: 0px; visibility: visible; position: absolute; top: 0px;z-index:2"

          codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701standby=

          loading

                     type=application/x-oleobject height=300 width=320

                     classid=clsid:6bf52a52-394a-11d3-b153-00c04f79faa6 viewastext>

          <param name="url" value="地址">

                     

           <param name="audiostream" value="-1">

             <param name="autosize" value="0">

             <param name="autostart" value="-1">

             <param name="animationatstart" value="0">

             <param name="allowscan" value="-1">

             <param name="allowchangedisplaysize" value="-1">

             <param name="autorewind" value="0">

             <param name="balance" value="0">

             <param name="baseurl" value>

             <param name="bufferingtime" value="5">

             <param name="captioningid" value>

             <param name="clicktoplay" value="-1">

             <param name="cursortype" value="0">

             <param name="currentposition" value="-1">

             <param name="currentmarker" value="0">

             <param name="defaultframe" value>

             <param name="displaybackcolor" value="0">

             <param name="displayforecolor" value="16777215">

             <param name="displaymode" value="0">

             <param name="displaysize" value="4">

             <param name="enabled" value="-1">

             <param name="enablecontextmenu" value="-1">

             <param name="enablepositioncontrols" value="0">

             <param name="enablefullscreencontrols" value="0">

             <param name="enabletracker" value="-1">

             <param name="invokeurls" value="-1">

             <param name="language" value="-1">

             <param name="mute" value="0">

             <param name="playcount" value="1">

             <param name="previewmode" value="0">

             <param name="rate" value="1">

             <param name="samilang" value>

             <param name="samistyle" value>

             <param name="samifilename" value>

             <param name="selectionstart" value="-1">

             <param name="selectionend" value="-1">

             <param name="sendopenstatechangeevents" value="-1">

             <param name="sendwarningevents" value="-1">

             <param name="senderrorevents" value="-1">

             <param name="sendkeyboardevents" value="0">

             <param name="sendmouseclickevents" value="0">

             <param name="sendmousemoveevents" value="0">

             <param name="sendplaystatechangeevents" value="-1">

             <param name="showcaptioning" value="0">

             <param name="showcontrols" value="-1">

             <param name="showaudiocontrols" value="-1">

             <param name="showdisplay" value="0">

             <param name="showgotobar" value="0">

             <param name="showpositioncontrols" value="-1">

             <param name="showstatusbar" value="-1">

             <param name="showtracker" value="-1">

             <param name="transparentatstart" value="-1">

             <param name="videoborderwidth" value="0">

             <param name="videobordercolor" value="0">

             <param name="videoborder3d" value="0">

             <param name="volume" value="70">

             <param name="windowlessvideo" value="0">

          </object>

           

           

           

          realplayer 播放器

          <:  object id=video1 classid=" clasid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa"

               width=320 height=240 align="middle">

                 <param name="controls" value="inagewindow">

                 <param name="console" value="chicp1">

                 <param name="autostar" value="true">

                 <param name="src" value="地址">

                 <embed        

                          src="地址"          

                        type="audio/x-pn-realaudio-plugin" console="chip1"                

                  controls="imagewindow" width=320 height=240 autostart=true align="middle">

                 </embed>

               </object>

           

           

           

          <:  script language="vbscript">        

          a=msgbox("真的要刪除該記錄嗎?",1,"注意")

          if a=1 then

           location="dodelete.asp?id=<%=id%>"           //指向執行刪除的頁面dodelete.asp

           else

           history.go(-1)

          end if

          </script>

           

           

           

          其中id=<%=id%>是指從表單中取得的數據編號,當然也可以是其他的東東。

          asp打印

          var strfeature="height=360,width=500,status=no,toolbar=no,resizable=no,menubar=no,location=no";

          var awin = window.open("","print",strfeature);

          awin.document.open();

          awin.document.write("<html>");

          awin.document.write("<head>");

          awin.document.write("<title>打印服務</title>");

          awin.document.write("</head>");

          awin.document.write("<body onload='window.print();window.close();'>");

          awin.document.write("<img src=" + document.mvimage.src +">");

          awin.document.write("<font size='0'>");

          awin.document.write("<br><br>版權所有 鄭州達維計算機技術有限公司</a>  ");

          awin.document.write(" http://www.zzdw.com";;);

          awin.document.write("</font>");

          awin.document.write("</body>");

          awin.document.write("</html>");

          awin.document.close();  

          輸入框加背景色<:   input style='background-color:red'>在加入type="xxx"可以為其它的控件加入背景顏色。

          下拉菜單變背景色

          <:  select name="select">

           <option style="background-color:#f0f0f0">111111111</option>

           <option style="background-color:#cccccc">111111111</option>

          </select>

           

           

           

          兩個下拉表單相互關聯

          <form name="doublecombo">

          <:   select name="example" size="1" onchange="redirect(this.options.selectedindex)">

          <option>陽光在線</option>

          <option> www.sunness.com</option>

          <option>sunness.com</option>

          </select>

          <:   select name="stage2" size="1">  

          <option value=" http://www.80cn.com";;>陽光在線</option>

          </select>

          <:    input type="button" name="test" value="go!"  

          onclick="go()">  

          </p>  

           

           

          <  script>  

          <!--  

          var groups=document.doublecombo.example.options.length  

           var group=new array(groups)  

           for (i=0; i<groups; i++)  

           group[i]=new array()  

          group[0][0]=new option("陽光在線"," http://www.sunness.com";  

           

           

          group[1][0]=new option("陽光在線"," http://www.sunness.com";  

           group[1][1]=new option("sunness"," http://www.sunness.com";   

           group[1][2]=new option("sunness.com"," http://www.sunness.com";  

           

          group[2][0]=new option("aaat"," http://www.sunness.com";  

           group[2][1]=new option("bbb"," http://www.sunness.com";  

           group[2][2]=new option("ddd"," http://www.sunness.com";  

           group[2][3]=new option("ccc"," http://www.sunness.com";  

          var temp=document.doublecombo.stage2  

          function redirect(x){  

           for (m=temp.options.length-1;m>0;m--)  

           temp.options[m]=null  

           for (i=0;i<group[x].length;i++){  

           temp.options[i]=new option(group[x][i].text,group[x][i].value)  

           }  

           temp.options[0].selected=true  

           }  

          function go(){  

           location=temp.options[temp.selectedindex].value  

           }  

           //-->  

           </script>  

           </form>

           

           

           

          1. 如何在網頁中加入注釋

          ◆代碼:< !-- 這是注釋 --> 

           

           

           

          2. 如何在網頁中加入email鏈接并顯示預定的主題

          ◆代碼:<:   a href="mailto:yourmail@xxx.xxx?subject=你好">send mail< /a>

           

           

           

          3. 如何制作電子郵件表單

          ◆在<form>中輸入action="youremail@xxx.xxx" ,提交采用post方法。

           

           

           

          4. 如何避免別人將你的網頁放入他的框架(frame)中

          ◆在源代碼中的<head>< /head>之間加入如下代碼:

          <:   s cript language="javas cript"><!--

          if (self!=top){top.location=self.location;}

          -->< /s cript>

           

           

           

          5. 如何自動加入最后修改日期

          ◆在源代碼中的<body>< /body>之間加入如下代碼:

          < s cript language="javas cript"><!--

          document.write("last updated:"+document.lastmodified);

          -->< /s cript>

           

           

          6. 如何讓背景圖象不滾動

          ◆代碼:<:   body background="bg.gif" bgproperties="fixed" >

          ◆在dreamweaver中用「text-custom style-edit style sheet-new-redefine html tag中選擇body,然后在background中的attachment里選fixed

           

           

          7. 如何將網頁定時關閉

          ◆在源代碼中的<body>后面加入如下代碼:

          <:     s cript language="javas cript"> <!--

          settimeout('window.close();', 60000);

          --> < /s cript>

          在代碼中的60000表示1分鐘,它是以毫秒為單位的。

           

           

           

          8. 將網頁加入收藏夾

          ◆請使用如下代碼:(注意標點符號)

          <:    a href='#' onclick="window.external.addfavorite(' http://qiangwei.126.com','【夢想天空】qiangwei.126.com 各種網頁工具教程dwflashfireworkscgi教學、聊天交友……')" target="_top">將本站加入收藏夾< /a>

           

           

          9. 如何定義網頁的關鍵字(keywords)

          ◆格式如下:

          <:    meta name="keywords" content="dreamweaver,flash,fireworks">

          content中的即為關鍵字,用逗號隔開

          ◆在dreamweaver中用「insert-head-keywords命令

           

           

           

          10. 如何設置命令來關閉打開的窗口

          ◆在源代碼中加入如下代碼:

          <:    a href="/" onclick="javas cript:window.close(); return false;">關閉窗口< /a>

           

           

          11. 如何在網頁中加入書簽,在頁面內任意跳轉

          ◆在源代碼中需要插入書簽的地方輸入,在調用的地方輸入top,其中的top是你設定的書簽名字。

          ◆在dreamweaver中用菜單的「insert-name anchor」命令插入書簽,調用時,在link中輸入#toptop為書簽名。

           

           

           

          12. 如何為不支持框架的瀏覽器指定內容

          ◆在源代碼中加入下面代碼:

          < body><noframes>本網頁有框架結構,請下載新的瀏覽器觀看< /noframes></ body>

           

           

          13. 如何在網頁中加入單個或幾個空格

          ◆在源代碼中輸入 ,每個 之間請用空格分開。

          ◆在dreamweaver中用<ctrl>+<shift>+<space>插入空格或任輸幾個字符,然后將其色彩設成背景的色彩!

           

           

          14. 如何在網頁中加入書簽,在多個頁面之間任意跳轉

          ◆方法與上面類似,不過做鏈接時要在書簽名前加上網頁文件名,如:other.htm#top,這樣一來就會跳轉到other.htm頁面中的top書簽處。

           

           

           

          15. 如何使表格(table)沒有邊框線

          ◆將表格的邊框屬性:border="0"

           

           

          16. 如何隱藏狀態欄里出現的link信息

          ◆請使用如下代碼:

          <:   a href=" http://qiangwei.126.com";; onmouseover="window.status='none';return true">夢想天空< /a>

           

           

           

          17. 如何定時載入另一個網頁內容

          ◆在源代碼中的<head>< /head> 加入如下代碼:

          <:   meta http-equiv="refresh" content="40;url=http://qiangwei.126.com">

          40秒后將自動 http://qiangwei.126.com所在的網頁

           

           

          18. 如何為網頁設置背景音樂

          ◆代碼:<:   embed src="music.mid" autostart="true" loop="2" width="80" height="30" >

          src:音樂文件的路徑及文件名;

          autostarttrue為音樂文件上傳完后自動開始播放,默認為false(否)

          looptrue為無限次重播,false為不重播,某一具體值(整數)為重播多少次

          volume:取值范圍為"0-100",設置音量,默認為系統本身的音量

          starttime"分:秒",設置歌曲開始播放的時間,如,starttime="00:10",從第10開始播放

          endtime "分:秒",設置歌曲結束播放的時間

          width:控制面板的寬

          height:控制面板的高

          controls:控制面板的外觀

          controls="console/smallconsole/playbutton/pausebutton/stopbutton/volumelever"

          console:正常大小的面板

          smallconsole:較小的面板

          playbutton:顯示播放按鈕

          pausebutton:顯示暫停按鈕

          stopbutton:顯示停止按鈕

          volumelever:顯示音量調節按鈕

          hidden:為true時可以隱藏面板

           

           

          19. 如何去掉鏈接的下劃線

          ◆在源代碼中的<head></head>之間輸入如下代碼:

          <style type="text/css"> <!--

          a { text-decoration: none}

          --> < /style>

          ◆在dreamweaver中用「text-custom style-edit style sheet-new-redefine html tag中選擇a,然后在decoration中選中none

           

           

           

          20. timeline中的layer走曲線

          ◆要使得timeline中的layer走曲線,你得先讓他走出直線來,然后在最后一frame和第一frame中間的任何一frame上點右鍵,可以看到有個 add keyframe ,點一下,然后把你的layer移動到你要的位置,dw會自動生成曲線,good luck !

           

           

           

          posted on 2005-09-13 12:32 Alpha 閱讀(1147) 評論(0)  編輯  收藏 所屬分類: JavaScript
          主站蜘蛛池模板: 无棣县| 永康市| 永善县| 海晏县| 泰兴市| 隆昌县| 隆安县| 滨州市| 新竹市| 商洛市| 铁力市| 英德市| 昌平区| 德清县| 临泉县| 阜城县| 淮南市| 军事| 昌平区| 吴旗县| 博野县| 伽师县| 浦北县| 清流县| 连南| 驻马店市| 通山县| 华亭县| 安宁市| 灌南县| 子洲县| 梅河口市| 尼木县| 手游| 皋兰县| 铁岭市| 长宁区| 淅川县| 观塘区| 体育| 台南县|