丄諦啲仇魜ヤ
          如 果 敵 人 讓 你 生 氣 , 那 說 明 你 沒 有 勝 他 的 把 握!
          posts - 6,comments - 56,trackbacks - 1
          1.鼠標移動上去,圖片變亮,移開又變成灰色。改變的是透明度。
          <style>
          .p1{filter:Alpha(Opacity=20)}
          .p2{filter:Alpha(Opacity=100)}
          </style>
          <img src="/image/xxx.gif" border=0 class=p1 on mouseover="this.classname=p2"   on mouseout="this.classname=p1">
          2.怎樣在網頁中播放mp3格式音樂
          <html>
          <title></title>
          <body>
          <embed src="http://music.jztele.com/mp3/dianying/xyxy.mp3"; loop=false autostart=true name=bgss width="0" height=0>
          </body>
          </html>
          詳細說明:
          <embed
          src="xx.mp3" 音樂文件
          loop=false 是否重復播放
          autostart=true 是否自動開始
          name=bgss 為了控制而設定的名字
          width="0" height="0" 寬、高 >
          3.滾動現實公告
          <table width="800" border="0" cellspacing="0" cellpadding="0">
          <tbody>
          <tr style="text-align: center;">
          <td height="0"> <hr noshade> <p>
          <marquee>
          <xmp> 事件文字滾動 ——公告</xmp>
          </marquee>
          </p>
          <hr noshade></td>
          </tr>
          </tbody>
          </table>
          4.以圖片作為按鈕
          <form method="post" action="test.html">
          <input type="text" name="textfield">
          <input type="text" name="textfield2">
          <input type="image" border="0" name="imageField" src="../img/submit.jpg" width="71" height="32" >
          </form>
          5.表格中單元格之間分隔線的隱藏方法
          其實上面的三個表格都有三行三列,隱藏分隔線的訣竅在于rules,察看這三個表格的源代碼,我們可以看到<TABLE>標簽中都有rules。 它有三個參數(cols,rows,none),當rules=cols時,表格會隱藏縱向的分隔線,這樣我們就只能看到表格的行;當rules=rows時,則 隱藏了橫向的分隔線,這樣我們只能看到表格的列;而當rules=none時,縱向分隔線和橫向分隔線將全部隱藏。
          ­
          6.表格邊框的隱藏
          表格邊框的顯示與隱藏,是可以用frame參數來控制的。請注意它只控制表格的邊框圖,而不影晌單元格。
          只顯示上邊框 <table frame=above>
          只顯示下邊框 <table frame=below>
          只顯示左、右邊框 <table frame=vsides>
          只顯示上、下邊框 <table frame=hsides>
          只顯示左邊框 <table frame=lhs>
          只顯示右邊框 <table frame=rhs>
          不顯示任何邊框 <table frame=void>
          7.刷新的不同狀態
          ­
          非模態刷新父頁面:window.opener.location.reload();
          模態刷新父頁面:window.dialogArguments.location.reload();  
          window.location.assign('chklogin.jsp');
          window.location.reload('chklogin.jsp');
          以后用前者進行刷新吧。后者似乎對FF 不怎么兼容。
          8.文字過長,縮略顯示為...
          <DIV STYLE="width: 120px; border: 1px solid blue;
          overflow: hidden; text-overflow:ellipsis">
          <NOBR title="就是比如有一行文字,很長,表格內一行顯示不下.">就是比如有一行文字,很長,表格內一行顯示不下.</NOBR>
          </DIV>
          9.加入收藏夾通用代碼
          ­
          <script type="text/javascript">
          function addBookmark(title,url)
          {
          if (window.sidebar)
          {
          window.sidebar.addPanel(title, url,"");
          } else if( document.all )
          {
          window.external.AddFavorite( url, title);
          } else if( window.opera && window.print )
          {
          return true;
          }
          }
          </script>
          頁面使用:<a href=javascript:addBookmark('天極網網頁陶吧','http://homepage.yesky.com/')> 添加到收藏</a>
          10.幾種彈出窗口
          用戶輸入:var msg=prompt("請輸入密碼:");if(msg == "PKU")  彈出輸入框。
          用戶確定:var IsOk = confirm('ok');
          警告:alert("對不起");
          open為打開一個窗口。
          11.動態改變 下拉列表的值。
          ­
          document.formname.elements[第幾個元素].text = "test";
          eg:
          document.test9_1.elements[0].options[0].text="昆明市";
          當然也可以用,之所以寫出來是因為很多時候,我總是習慣用value,而忽略了text屬性:
          document.getElementById('select').options[0].text="昆明市";
          ­
          12.動態插入表格內容:
          document.getElementById('saleAndLost').rows[1].cells
          x[1].innerHTML="test";
          13.播放器代碼
          ­
          (1)media player代碼:
          <DIV>
          <OBJECT id=videowindow1 height=185 width=179 classid=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6>
          <PARAM NAME="URL" VALUE="http://tyrb.com/big5/site1/images/2006-02/17/020203170937500170795.mp3">
          <PARAM NAME="playCount" VALUE="infinite">
          <PARAM NAME="autoStart" VALUE="1">
          <PARAM NAME="volume" VALUE="50">
          <PARAM NAME="uiMode" VALUE="full">
          <PARAM NAME="stretchToFit" VALUE="1">
          </OBJECT>
          </DIV>
          ­
          其中http://tyrb.com/big5/site1/images/2006-02/17/020203170937500170795.mp3就是歌曲"幸福像花兒一樣"的地址,
          改變這個地址也就改變了你的歌曲
          ­
          (2)WMP播放器
          <embed src="影音文件地址" width="播放器寬" height="播放器高" autostart="true" loop="true" align="center" volume="200" type="audio/x-pn-realaudio-plugin" exts="ra,ram" Init fn="load-types" mime-types="mime.types" ALT="(Random)"></embed>
          (3)Flash播放器
          <embed src="Flash地址" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="播放器寬" height="播放器高[" quality="High"></embed>
          ­
          (4)RealPlayer播放器
          <object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="480" height="360">
          <param name="src" value="dfA.rmvb" />
          <param name="controls" value="ImageWindow" />
          <param name="console" value="_master" />
          </object><br />
          <object classid="CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="480" height="32">
          <param name="src" value="dfA.rmvb" />
          <param name="controls" value="controlpanel" />
          <param name="AUTOSTART" value="1">
          <param name="console" value="_18c03c83e52df1f1285b0ac2d1ea7911" />
          </object>
          14.window.open參數詳解
          (1). 使用舉例:
             <SCRIPT   LANGUAGE="javascript">    
            <!--    
            window.open   ('page.html',   'newwindow',   'height=100,   width=400,   top=0,   left=0,   toolbar=no,   menubar=no,   scrollbars=no,resizable=no,location=no,   status=no')    
            //寫成一行    
            -->    
            </SCRIPT>    
          (2). 參數詳細描述
            'page.html'   彈出窗口的文件名;    
            'newwindow'   彈出窗口的名字(不是文件名),非必須,可用空''代替;    
            height=100   窗口高度;    
            width=400   窗口寬度;    
            top=0   窗口距離屏幕上方的象素值;    
            left=0   窗口距離屏幕左側的象素值;    
            toolbar=no   是否顯示工具欄,yes為顯示;    
            menubar,scrollbars   表示菜單欄和滾動欄。    
            resizable=no   是否允許改變窗口大小,yes為允許;    
            location=no   是否顯示地址欄,yes為允許;    
            status=no   是否顯示狀態欄內的信息(通常是文件已經打開),yes為允許;  
            
          1 網頁中所有鏈接去除下劃線:
          <style type="text/css">
          <!--
          a:link {
          text-decoration: none;
          }
          a:visited {
          text-decoration: none;
          }
          a:hover {
          text-decoration: none;
          }
          a:active {
          text-decoration: none;
          }
          -->
          </style>
          2在當前頁面定位
          <html>
          <head></head>
          <body>
          <a href="#first">one</a>
          <a href="#two">two</a>
          <a href="#three">three</a>
          <a name="first"><h1>one</h1>
          <p> firstfirstfirstfirst
          <br>
          <br><br><br><br><br><br><br><br><br><br><br><br>
          <br><br><br><br><br><br><br><br><br><br><br>
          firstfirstfirstfirstfirst
          </p><br/>
          <a name="two"><h1>two</h1>
          <p> twotwotwotwotwotwotwo
          <br><br><br><br><br><br><br><br><br><br><br><br>
          <br><br><br><br><br><br><br><br><br><br><br><br>
          twotwotwotwotwotwotwotwotwo
          </p><br/>
          <a name="three"><h1>three</h1>
          <p> threethreethreethreethree
          <br><br><br><br><br><br><br><br><br><br><br><br>
          <br><br><br><br><br><br><br><br><br><br><br>
          threethreethreethreethree
          <br>
          3   Frame
            <frameset cols="50,400">
          <frame src="div.html">
          <frame src="about:blank">
          </frameset>
          ////////////////////////////////////
          <html>
          <frameset rows="15%,*">
               <frame src="top.html" noresize>
               <frameset cols="30%,*">
                   <frame src="left.html" scrolling=yes>
                   <frame src="right1.html">
               </frameset>
              <noframes>
                  <body>
                      <p>你好啊</p>
                  </body>
              </noframes>
          </frameset>
          </html>
          4 自己寫過的
          <%@ page language="java" pageEncoding="GBK"
          c%>
          <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean"
          prefix="bean"%>
          <%@ taglib uri="http://jakarta.apache.org/struts/tags-html"
          prefix="html"%>
          <html>
          <head>
            <title>JSP for RegisterForm form</title>
            <script language="javascript">
          <!--  
          function check()
          {  var name=document.ReForm.name.value;
              var pass=document.ReForm.password.value;
              var repass=document.ReForm.repassword.value;
              var email=document.ReForm.email.value;
          //驗證數據的合法性
              if (!name||name.replace(/\s/g,"")=="")
              {  alert("用戶名不能為空或空格,請輸入用戶名!");
               ReForm.name.focus();
               return false;
              }
              if (!pass||pass.replace(/\s/g,"")=="")
              {
               alert("用戶密碼不能為空或空格,請輸入密碼!");
               ReForm.password.focus();
               return false;
              }
              if (!repass||repass.replace(/\s/g,"")=="")
              {   alert("用戶確認密碼不能為空或空格,請輸入密碼!");
               ReForm.repassword.focus();
               return false;
              }
             if (pass != repass)
              {  alert("密碼與確認密碼不同");
              ReForm.password.focus();
               return false;
          }
              if (!email||email.replace(/\s/g,"")=="")    
            {
             alert("請輸入Email且不能為空格!");
             ReForm.email.focus();
             return false;
            }
            if (!(email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1))
            { alert("請輸入合法的Email!");
            ReForm.email.focus();
            return false;
            }  
          }
          //-->
          </script>
          </head>
          <body>
            <center>
             <html:form action="/register" method="post" focus="name">
             name : <html:text property="name" />
              <br />
             password : <html:password property="password" />
              <br />
             repassword : <html:password property="repassword" />
              <br />
             sex:<html:radio property="sex" value="1" >男</html:radio><html:radio property="sex" value="0">女</html:radio>
                <br />
             like:
                <html:multibox property="array" value="bc"></html:multibox>編程
                 <html:multibox property="array">lq</html:multibox>籃球<br/>
             email : <html:text property="email" />
              <br/>
              <html:submit >注冊</html:submit>
              <html:reset>取消</html:reset>
             </html:form>
            </center>
          </body>
          </html>
          5常用的正則表達式


          if(days.search("^[0-9]*[1-9][0-9]*$")!=0)
                      { 
                        alert("請輸入整數");
                        apply_HolidayForm.days.value="";
                        apply_HolidayForm.days.focus();
                        return false;
                   
                      }
          ^\d+$  //匹配非負整數(正整數 + 0)
          ^[0-9]*[1-9][0-9]*$  //匹配正整數
          ^((-\d+)|(0+))$  //匹配非正整數(負整數 + 0)
          ^-[0-9]*[1-9][0-9]*$  //匹配負整數
          ^-?\d+$    //匹配整數
          ^\d+(\.\d+)?$  //匹配非負浮點數(正浮點數 + 0)
          ^(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*))$  //匹配正浮點數
          ^((-\d+(\.\d+)?)|(0+(\.0+)?))$  //匹配非正浮點數(負浮點數 + 0)
          ^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$  //匹配負浮點數
          ^(-?\d+)(\.\d+)?$  //匹配浮點數
          ^[A-Za-z]+$  //匹配由26個英文字母組成的字符串
          ^[A-Z]+$  //匹配由26個英文字母的大寫組成的字符串
          ^[a-z]+$  //匹配由26個英文字母的小寫組成的字符串
          ^[A-Za-z0-9]+$  //匹配由數字和26個英文字母組成的字符串
          ^\w+$  //匹配由數字、26個英文字母或者下劃線組成的字符串
          ^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$    //匹配email地址
          ^[a-zA-z]+://匹配(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$  //匹配url
          匹配中文字符的正則表達式: [\u4e00-\u9fa5]

          if(value.search("[\u4e00-\u9fa5]")==0){
                      alert("類型名不能為中文!");
                   return false;
          }
          匹配雙字節字符(包括漢字在內):[^\x00-\xff]
          匹配空行的正則表達式:\n[\s| ]*\r
          匹配HTML標記的正則表達式:/<(.*)>.*<\/>|<(.*) \/>/
          匹配首尾空格的正則表達式:(^\s*)|(\s*$)
          匹配Email地址的正則表達式:\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
          匹配網址URL的正則表達式:^[a-zA-z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$
          匹配帳號是否合法(字母開頭,允許5-16字節,允許字母數字下劃線):^[a-zA-Z][a-zA-Z0-9_]{4,15}$
          匹配國內電話號碼:(\d{3}-|\d{4}-)?(\d{8}|\d{7})?
          匹配騰訊QQ號:^[1-9]*[1-9][0-9]*$
          下表是元字符及其在正則表達式上下文中的行為的一個完整列表:
          \ 將下一個字符標記為一個特殊字符、或一個原義字符、或一個后向引用、或一個八進制轉義符。
          ^ 匹配輸入字符串的開始位置。如果設置了 RegExp 對象的Multiline 屬性,^ 也匹配 ’\n’ 或 ’\r’ 之后的位置。
          $ 匹配輸入字符串的結束位置。如果設置了 RegExp 對象的Multiline 屬性,$ 也匹配 ’\n’ 或 ’\r’ 之前的位置。
          * 匹配前面的子表達式零次或多次。
          + 匹配前面的子表達式一次或多次。+ 等價于 {1,}。
          ? 匹配前面的子表達式零次或一次。? 等價于 {0,1}。
          {n} n 是一個非負整數,匹配確定的n 次。
          {n,} n 是一個非負整數,至少匹配n 次。
          {n,m} m 和 n 均為非負整數,其中n <= m。最少匹配 n 次且最多匹配 m 次。在逗號和兩個數之間不能有空格。
          ? 當該字符緊跟在任何一個其他限制符 (*, +, ?, {n}, {n,}, {n,m}) 后面時,匹配模式是非貪婪的。非貪婪模式盡可能少的匹配所搜索的字符串,而默認的貪婪模式則盡可能多的匹配所搜索的字符串。
          . 匹配除 "\n" 之外的任何單個字符。要匹配包括 ’\n’ 在內的任何字符,請使用象 ’[.\n]’ 的模式。
          (pattern) 匹配pattern 并獲取這一匹配。
          (?:pattern) 匹配pattern 但不獲取匹配結果,也就是說這是一個非獲取匹配,不進行存儲供以后使用。
          (?=pattern) 正向預查,在任何匹配 pattern 的字符串開始處匹配查找字符串。這是一個非獲取匹配,也就是說,該匹配不需要獲取供以后使用。
          (?!pattern) 負向預查,與(?=pattern)作用相反
          x|y 匹配 x 或 y。
          [xyz] 字符集合。
          [^xyz] 負值字符集合。
          [a-z] 字符范圍,匹配指定范圍內的任意字符。
          [^a-z] 負值字符范圍,匹配任何不在指定范圍內的任意字符。
          \b 匹配一個單詞邊界,也就是指單詞和空格間的位置。
          \B 匹配非單詞邊界。
          \cx 匹配由x指明的控制字符。
          \d 匹配一個數字字符。等價于 [0-9]。
          \D 匹配一個非數字字符。等價于 [^0-9]。
          \f 匹配一個換頁符。等價于 \x0c 和 \cL。
          \n 匹配一個換行符。等價于 \x0a 和 \cJ。
          \r 匹配一個回車符。等價于 \x0d 和 \cM。
          \s 匹配任何空白字符,包括空格、制表符、換頁符等等。等價于[ \f\n\r\t\v]。
          \S 匹配任何非空白字符。等價于 [^ \f\n\r\t\v]。
          \t 匹配一個制表符。等價于 \x09 和 \cI。
          \v 匹配一個垂直制表符。等價于 \x0b 和 \cK。
          \w 匹配包括下劃線的任何單詞字符。等價于’[A-Za-z0-9_]’。
          \W 匹配任何非單詞字符。等價于 ’[^A-Za-z0-9_]’。
          \xn 匹配 n,其中 n 為十六進制轉義值。十六進制轉義值必須為確定的兩個數字長。
          \num 匹配 num,其中num是一個正整數。對所獲取的匹配的引用。
          \n 標識一個八進制轉義值或一個后向引用。如果 \n 之前至少 n 個獲取的子表達式,則 n 為后向引用。否則,如果 n 為八進制數字 (0-7),則 n 為一個八進制轉義值。
          \nm 標識一個八進制轉義值或一個后向引用。如果 \nm 之前至少有is preceded by at least nm 個獲取得子表達式,則 nm 為后向引用。如果 \nm 之前至少有 n 個獲取,則 n 為一個后跟文字 m 的后向引用。如果前面的條件都不滿足,若 n 和 m 均為八進制數字 (0-7),則 \nm 將匹配八進制轉義值 nm。
          \nml 如果 n 為八進制數字 (0-3),且 m 和 l 均為八進制數字 (0-7),則匹配八
            
          posted on 2007-09-02 09:12 Crying 閱讀(660) 評論(10)  編輯  收藏 所屬分類: JavaScript和CSS

          FeedBack:
          # re: 網頁實用的
          2007-09-19 19:43 | Crying
          倒計時

          <Script Language="JavaScript">
             var timedate= new Date("October 1,2007");
             var times= "2010年國慶節";
             var now = new Date();
             var date = timedate.getTime() - now.getTime();
             var time = Math.floor(date / (1000 * 60 * 60 * 24));
             if (time >= 0)
             document.write( "現在離"+times+"還有: "+time +"天")
          </Script>
            回復  更多評論
            
          # re: 網頁實用的
          2007-09-19 19:45 | Crying
          重定向
          <html:submit onclick="javascript:window.location.href='userIpt.jsp'">返回</html:submit>
          //////////////////////////////////

          <html>
          <head>
          <title>錯誤頁面</title>
          <script type="text/javascript">
          <!--
          function check(){

          form.action="log.jsp";
          }
          //-->
          </script>
          </head>

          <body bgcolor="#E0F0F8">
          <center>
          <form action="" name="form">
          對不起你 !無權訪問!
          <br>
          <html:submit onclick="check()">返回</html:submit>
          </form>
          </center>
          </body>
          </html>
          /********刷新frame***********/

          window.parent.frames('leftFrame').document.location.reload();
          javascript:window.parent.frames('leftFrame').document.location.reload();  回復  更多評論
            
          # re: 網頁實用的
          2007-09-19 19:46 | Crying
          <head>

          <title>Untitled Document</title>

          <meta http-equiv="Content-Type" content="text/html; charset=gb2312">

          <SCRIPT LANGUAGE="JavaScript">

          <!--

          function formHandler(URL)
          {


          window.location.href = URL;

          }
          // -->


          </SCRIPT>

          </head>

          <FORM name = "form">

          <SELECT NAME="site" SIZE=1 onChange ="formHandler(this.value)">

          <option value="">連接到…. </option>

          <option value="http://www.ddvip.com">豆豆技術</option>

          <option value="http://soft.ddvip.net">豆豆軟件 </option>

          <option value="http://bbs.ddvip.net">豆豆論壇 </option>

          <option value="http://vip.ddvip.net">視頻在線 </option>

          <option value="http://soft.ddvip.net">豆豆軟件 </option>

          </SELECT>
          </FORM>
            回復  更多評論
            
          # re: 網頁實用的
          2007-09-19 19:48 | Crying
          退出
          1.。<html:submit onclick="javascript:window.close()">退出</html:submit>
          2.。<a href="javascript:window.close()">關閉</a>


          除去空格
          in Javascript:
          去掉leading/trailing 空格: str = str.replace(/^\s+|\s+$/g,"");
          去掉all空格: str = str.replace(/\s+/g,"");





            回復  更多評論
            
          # re: 網頁實用的
          2007-09-20 18:19 | Crying
          框架



          <frameset rows="21%,*">
          <frame src="aa.html" noresize>//noresize 是確定框架的大小固定且不能改變
          <frameset cols="20%,*">
          <frame src="bb.html" noresize>
          <frame src="bb.html" scrolling="yes" >//scrolling 是確定滾動條是否對用戶有效,yes,no,auto
          </frameset>
          </frameset>  回復  更多評論
            
          # re: 網頁實用的
          2007-10-18 13:00 | Crying
          innerHTML 使用

          <html>
          <head>
          <style type="text/css" >

          span.bb{color :red}
          </style>
          <script type="text/javascript" language="javascript">
          function load()
          {
          alert("vv");
          document.getElementById("inner").innerHTML="成功";
          }
          </script>
          </head>
          <body onload="load()">
          <span class="bb" id="inner">你還沒輸入</span>
          </body>
          </html>  回復  更多評論
            
          # re: 網頁實用的
          2007-10-18 13:05 | Crying
          select使用 和用span改變字體 用li來代替<br/>
          <html>
          <head>
          <script language="javascript" type="text/javascript">
          function checkSelect(value)
          {
          alert(document.getElementById("Select1").value);
          alert(document.getElementById("Select1").options[document.getElementById("Select1").selectedIndex].text);
          alert(value);
          }

          </script>
          <link type="text/css" rel="stylesheet" href="myStyle.css"/>
          </head>
          <body>
          <div align="center"><img src="ww.jpg" width="98%" height="126"></div>
          </div>
          <select id="Select1" onChange="checkSelect(this.value)">
          <option value="00" selected>...</option>
          <option value="1">2001</option>
          <option value="2">2002</option>
          <option value="3">2003</option>
          <option value="4">2004</option>
          <option value="5">2005</option>
          <option value="6">2006</option>
          </select>
          <ul>
          <span>真的<span>|
          <span>假的</span>

          <li class="shu">vvv</li>
          <li><font color="blue">ddddddddd</font></li>

          <li><span> dddddddddd</span></li>
          </ul>
          <p><a href="#">連接的變化</a>
          <input name="dd" type="text" id="dd" onMouseOver=this.focus()>
          <input type="text" onmouseover=this.focus()>
          </p>

          </body>

          </html>
          /******************************************
          span{color:blue; font-size:24px}
          li{list-style:none}

          a:link{color:black; text-decoration:none}
          a:visited{color:red; text-decoration:none }
          a:hover{color:yellow ; text-decoration: none}
          a:active{color:red ; text-decoration:none}

          .shu{color: #33FF66}





            回復  更多評論
            
          # re: 網頁實用的[未登錄]
          2007-11-20 10:15 | Crying
          打印

          <a href=javascript:window.print()>打 印</a>]  回復  更多評論
            
          # re: 網頁實用的
          2007-12-03 10:56 | Crying
          驗證 IP

          function chk(){
          var ip= document.getElementById("v").value;

          if(!ip||ip.replace(/\s/g,"")=="")
          {
          alert("IP不能為空!");
          return false;
          }

          if (!(/^(\d{1,3})(\.\d{1,3}){3}$/.test(ip)))
          { alert("IP格式錯誤!");
          return false;
          }
          for (var j=0;j<4;j++)
          { if (ip.split('.')[j]>255)
          { alert("IP中的一段或多段數字超出范圍!");
          return false;
          }
          }

          }
          </script>


          驗證 三網段


          <script type="text/javascript">
          function chk(){
          var ip= document.getElementById("v").value;

          if(!ip||ip.replace(/\s/g,"")=="")
          {
          alert("網段不能為空!");
          return false;
          }

          if (!(/^(\d{1,3})(\.\d{1,3}){2}$/.test(ip)))
          { alert("網段格式錯誤!");
          return false;
          }
          for (var j=0;j<3;j++)
          { if (ip.split('.')[j]>255)
          { alert("IP中的一段或多段數字超出范圍!");
          return false;
          }
          }

          }
          </script>  回復  更多評論
            
          # re: 網頁實用的
          2008-04-24 11:03 | Crying

          checkbox或者是radio 判斷選擇項



          function checkQuestions()
          {
          var dd=document.getElementsByName("question");
          var isSelected=false;
          var StrValue="";
          for(var i=0;i<dd.length;i++){
          if(dd[i].checked){
          isSelected=true;
          StrValue+=dd[i].value+",";
          }
          }
          if(!isSelected){
          alert('您沒選擇投票項!');
          }else{
          alert(StrValue);
          clearCheck();


          }
          }

          function clearCheck(){
          var dd=document.getElementsByName("question");
          for(var i=0;i<dd.length;i++){
          dd[i].checked=false;
          }
          }
            回復  更多評論
            
          主站蜘蛛池模板: 靖安县| 新竹县| 陇川县| 长岛县| 璧山县| 凤阳县| 牡丹江市| 天水市| 深水埗区| 龙州县| 鲁甸县| 札达县| 莒南县| 兰考县| 大宁县| 木里| 资阳市| 建阳市| 精河县| 防城港市| 家居| 于都县| 荣昌县| 施甸县| 青浦区| 武鸣县| 闽清县| 桑植县| 宜都市| 泰州市| 玉环县| 襄城县| 潮安县| 沈阳市| 三河市| 麻栗坡县| 乌鲁木齐县| 加查县| 武安市| 墨脱县| 马龙县|