當柳上原的風吹向天際的時候...

          真正的快樂來源于創造

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            368 Posts :: 1 Stories :: 201 Comments :: 0 Trackbacks

          #

               摘要: 對于Web前臺編程,使用JavaScript從表單form中提取用戶輸入的信息及驗證這些信息是一項日常任務,表單一般多包含文本框,單選框,下拉列表框,復選框,文本域等基本元素,如下所示: 下面是該頁面的HTML代碼: Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHi...  閱讀全文
          posted @ 2009-06-19 07:49 何楊 閱讀(577) | 評論 (0)編輯 收藏

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
          <HTML>
           
          <HEAD>
            
          <TITLE> New Document </TITLE>
            
          <META NAME="Generator" CONTENT="EditPlus">
            
          <META NAME="Author" CONTENT="">
            
          <META NAME="Keywords" CONTENT="">
            
          <META NAME="Description" CONTENT="">
           
          </HEAD>

           
          <BODY>
            
          <id="linkTest" HREF="#">哈哈</A>
           
          </BODY>
          </HTML>

          <SCRIPT LANGUAGE="JavaScript">
          <!--
          function $(id){
            
          return document.getElementById(id);
          }

          window.onload
          =function(){
              $(
          "linkTest").onclick=function(){
                  
          var parent=$("linkTest").parentNode;
                  parent.removeChild($(
          "linkTest"));
                  parent.appendChild(document.createTextNode(
          "哈哈"));
              }
          }    
          //-->
          </SCRIPT>
          posted @ 2009-05-05 18:12 何楊 閱讀(348) | 評論 (0)編輯 收藏

               摘要: <html>  <head>   <title>表單控件運用完整實例</title>  </head>   <body>        <div>   &...  閱讀全文
          posted @ 2009-03-16 12:46 何楊 閱讀(316) | 評論 (0)編輯 收藏

          1.在U盤下制作一個文件夾autorun.inf
          2.打開CMD,進入U盤所在的盤符,鍵入命令attrib +s +h +r +a autorun.inf,這是為了隱藏和保護文件夾autorun.inf。

          這樣,U盤病毒就不能再建立autorun.inf這個文件了。

          posted @ 2009-03-13 22:05 何楊 閱讀(121) | 評論 (0)編輯 收藏

          clientHeight   獲取對象的高度,不計算任何邊距、邊框、滾動條,但包括該對象的補白。     
          clientLeft   獲取   offsetLeft   屬性和客戶區域的實際左邊之間的距離。     
          clientTop   獲取   offsetTop   屬性和客戶區域的實際頂端之間的距離。     
          clientWidth   獲取對象的寬度,不計算任何邊距、邊框、滾動條,但包括該對象的補白。     
          clientX   設置或獲取鼠標指針位置相對于窗口客戶區域的   x   坐標,其中客戶區域不包括窗口自身的控件和滾動條。     
          clientY   設置或獲取鼠標指針位置相對于窗口客戶區域的   y   坐標,其中客戶區域不包括窗口自身的控件和滾動條。     
          clip   設置或獲取定位對象的哪個部分可見。     
          clipBottom   獲取對象剪裁區域的底邊坐標。     
          clipLeft   獲取對象剪裁區域的左邊坐標。     
          clipRight   獲取對象剪裁區域的右邊坐標。     
          clipTop   獲取對象剪裁區域的頂邊坐標。

          示例代碼(用于改變圖片寬度):
          var progressBarWidth=$("progressBar").clientWidth;
          var progressImgWidth=progressBarWidth*ratio/100;
          $("progressImg").width=progressImgWidth;
          posted @ 2009-03-11 17:24 何楊 閱讀(865) | 評論 (0)編輯 收藏

          在Eclipse中, 打開window->preferences 然后是General->Content Types,選擇JavaScript,在下面的Default encoding,改為GBK,選擇更新按鈕。
          再新建JS文件即可。如下圖:


          在頁面中引用該js文件時需要使用GBK的字符集,如下:
          <script src="web/page/dateBody.js" type="text/javascript" charset="GBK"></script>
          posted @ 2009-03-11 12:20 何楊 閱讀(641) | 評論 (0)編輯 收藏

               摘要: 題設: 請制作一個類,它可以累計多個字符串中字母的出現次數,最后可以以從高到低的順序打印出來,沒有出現過的字母不打印。 如輸入的句子是:ajax和JavaScript,最后輸出是 a出現了4次 j出現了2次 c出現了1次 i出現了1次 p出現了1次 r出現了1次 s出現了1次 t出現了1次 v出現了1次 x出現了1次 字母類: public class&n...  閱讀全文
          posted @ 2009-02-27 23:45 何楊 閱讀(386) | 評論 (0)編輯 收藏

               摘要: JS中對象的定義 JavaScript把其中的對象定義為“屬性的無序集合,每個屬性存放一個原始值,對象或者函數”。 因此,在JavaScript中,對象由特性(atrribute)構成,特性可以是原始值,也可以是引用值。如果特性存放的是函數,它將被看做對象的方法(method),否則該特性被看做屬性(property)。 對象的創建 對象是使用關鍵字new后跟要實例...  閱讀全文
          posted @ 2009-02-26 12:07 何楊 閱讀(207) | 評論 (0)編輯 收藏

          <html>
           
          <head>
            
          <title>使用混合方式創建類實例</title>
           
          </head>
            
          <body>   
              
          <div>
              
          <table border="1" class="holder" cellspacing="0" width="300" height="20">
                
          <caption>人員名單</caption>
                
          <tbody id="personList"> 
                  
          <TR>
                    
          <TH width="50">ID</TH>
                    
          <TH>姓名</TH>
                    
          <TH width="100">年齡</TH>
                  
          </TR> 
                
          </tbody>
              
          </table>
              
          </div>
              
          <hr/>
              
          <div>
                姓名:
          <input type="text" name="name"/><br/>
                年齡:
          <input type="text" name="age"/><br/>
                
          &nbsp;&nbsp;&nbsp;&nbsp;<input type="button" name="btn" value="提交"/><br/>
              
          </div>
            
          </body>
          </html>
          <script language="javascript">
          <!--

          function $(id){
            
          return document.getElementById(id);
          }


          window.onload
          =function(){
            $(
          "btn").onclick=function(){
              
          var emp=new Employee($("name").value,$("age").value); 
              $(
          "personList").appendChild(emp.getInfoLine()); 
              
              $(
          "name").value="";         
              $(
          "age").value="";
            }

          }


          var sn=0;

          function Employee(name,age){
            sn
          ++;
            
            
          this.name=name;
            
          this.age=age;
          }


          Employee.prototype.getName
          =function(){
            
          return this.name;
          }


          Employee.prototype.getAge
          =function(){
            
          return this.age;
          }


          Employee.prototype.getInfoLine
          =function(){
            
          var row=document.createElement("tr");
            row.setAttribute(
          "height",20);
           
            
          var cell1=document.createElement("td");
            cell1.appendChild(document.createTextNode(sn));
            row.appendChild(cell1); 

            
          var cell2=document.createElement("td");
            cell2.appendChild(document.createTextNode(
          this.name));
            row.appendChild(cell2); 

            
          var cell3=document.createElement("td");
            cell3.appendChild(document.createTextNode(
          this.age));
            row.appendChild(cell3); 

            
          return row;
          }

          //-->
          </script>
          posted @ 2009-02-24 16:08 何楊 閱讀(165) | 評論 (0)編輯 收藏

          package com.heyang;

          /**
           * 雙色球搖獎,效率較高,只生成七次隨機數
           * 
          @author: 何楊(heyang78@gmail.com)
           * @date: 2009-2-20-下午10:52:55
           
          */

          public class DoubleColorBall2{
              
          public static void main(String[] args){
                  
          for(int j=0;j<1000;j++){
                      
          int[] ballNumbers=getSevenNumbers();        
                      
          for(int i:ballNumbers){
                          System.out.print(i
          +",");
                      }

                      
                      System.out.print(
          "\n");
                  }

              }

              
              
          /**
               * 得到七個隨機數數組
               * 
          @return
               
          */

              
          public static int[] getSevenNumbers(){
                  
          // 被選擇的原始數組
                  final int originalArrayLen=33;
                  
          int[] originalArr=new int[originalArrayLen];
                  
                  
          for(int i=0;i<originalArr.length;i++){
                      originalArr[i]
          =i+1;
                  }

                  
                  
          // 要返回的數組
                  final int arrLength=7;
                  
          int[] arr=new int[arrLength];
                  
                  
          // 選取前六個(1-33)之間
                  for(int i=0;i<6;i++){
                      
          // 生成選取數的下標
                      int index=getRandomIntergerUnder(originalArrayLen-1-i);
                      
                      
          // 把選出的數挪到最后一個,以防它被再次選取
                      int temp=originalArr[index];
                      originalArr[index]
          =originalArr[originalArrayLen-1-i];
                      originalArr[originalArrayLen
          -1-i]=temp;
                      
                      
          // 把選出的數放入要返回的數組
                      arr[i]=temp;
                  }

                  
                  
          // 最后一個從1-15中選取
                  arr[6]=getIntgerBetween(15,1);
                  
                  
          return arr;
              }

              
              
          /**
               * 取得小于max的一個隨機整數,不包括max
               * 
          @param max
               * 
          @param min
               * 
          @return
               
          */

              
          public static int getRandomIntergerUnder(int max){        
                  
          return (int)(max*Math.random());
              }

              
              
          /**
               * 取得max與min之間的一個隨機整數,包括min和max兩值
               * 
          @param max
               * 
          @param min
               * 
          @return
               
          */

              
          public static int getIntgerBetween(int max,int min){
                  
          int interval=max-min;        
                  
                  
          return (int)Math.round((Math.random()*interval))+min;
              }

          }

           

          posted @ 2009-02-21 15:25 何楊 閱讀(418) | 評論 (0)編輯 收藏

          僅列出標題
          共28頁: First 上一頁 20 21 22 23 24 25 26 27 28 下一頁 
          主站蜘蛛池模板: 扶绥县| 杂多县| 金寨县| 赣州市| 晋江市| 杭锦后旗| 左云县| 桐乡市| 蒙阴县| 莲花县| 永吉县| 长武县| 龙里县| 永福县| 乌鲁木齐县| 平武县| 常德市| 长沙县| 井研县| 滨海县| 平谷区| 新和县| 临沧市| 弋阳县| 民勤县| 仁化县| 长阳| 武隆县| 延寿县| 永靖县| 禹州市| 荣昌县| 大名县| 龙口市| 陆河县| 民乐县| 洛南县| 墨玉县| 贵南县| 喀什市| 浪卡子县|