用代碼來充實生活

          夢想遙不可及
          posts - 3, comments - 0, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          2012年8月19日

          1.CGI(Common Gateway Interface(公用網關接口))
             工作原理:
                1.瀏覽器通過HTML表單或超鏈接請求指上一個CGI應用程序的URL。
            2.服務器收發到請求。
            3.服務器執行指定所CGI應用程序。
            4.CGI應用程序執行所需要的操作,通常是基于瀏覽者輸入的內容。
            5.CGI應用程序把結果格式化為網絡服務器和瀏覽器能夠理解的文檔(通常是HTML網頁)。
            6.網絡服務器把結果返回到瀏覽器中。
           2.php:
                  PHP 是一種 HTML 內嵌式的語言,是一種在服務器端執行的嵌入HTML文檔的腳本語言
              特性:       

              1、開放的源代碼:

            所有的PHP源代碼事實上都可以得到。

              2、PHP是免費的。

            和其它技術相比,PHP本身免費。

              3、php的快捷性

            程序開發快,運行快,技術本身學習快。嵌入于HTML:因為PHP可以被嵌入于HTML語言,它相對于其他語言。編輯簡單,實用性強,更適合初學者。

              4、跨平臺性強:

            由于PHP是運行在服務器端的腳本,可以運行在UNIXLINUXWINDOWS下。

              5、效率高:

            PHP消耗相當少的系統資源

              6、圖像處理:

            用PHP動態創建圖像

              7、面向對象:

            在php4,php5 中,面向對象方面都有了很大的改進,現在php完全可以用來開發大型商業程序。

              8、專業專注:

            PHP支持腳本語言為主,同為類C語言
          3.ASP(Active Server Page 動態服務器頁面):
              ASP是微軟公司開發的代替CGI腳本程序的一種應用,它可以與數據庫和其它程序進行交互,是一種簡單、方便的編程工具。

          4.JSP(Java Server Pages):
              JSP技術使用Java編程語言編寫類XML的tags和scriptlets,來封裝產生動態網頁的處理邏輯。網頁還能通過tags和scriptlets訪問存在于服務端的資源的應用邏輯。JSP將網頁邏輯與網頁設計和顯示分離,支持可重用的基于組件的設計,使基于Web的應用程序的開發變得迅速和容易。
            Web服務器在遇到訪問JSP網頁的請求時,首先執行其中的程序段,然后將執行結果連同JSP文件中的HTML代碼一起返回給客戶。插入的Java程序段可以操作數據庫、重新定向網頁等,以實現建立動態網頁所需要的功能。
            JSP與JavaServlet一樣,是在服務器端執行的,通常返回給客戶端的就是一個HTML文本,因此客戶端只要有瀏覽器就能瀏覽。





          posted @ 2012-08-19 11:03 mr.zhao 閱讀(225) | 評論 (0)編輯 收藏

          2012年8月13日

          js繼承有5種實現方式:
          1、繼承第一種方式:對象冒充
            function Parent(username){
              this.username = username;
              this.hello = function(){
                alert(this.username);
              }
            }
            function Child(username,password){
              //通過以下3行實現將Parent的屬性和方法追加到Child中,從而實現繼承
              //第一步:this.method是作為一個臨時的屬性,并且指向Parent所指向的對象,
              //第二步:執行this.method方法,即執行Parent所指向的對象函數
              //第三步:銷毀this.method屬性,即此時Child就已經擁有了Parent的所有屬性和方法
              this.method = Parent;
              this.method(username);//最關鍵的一行
              delete this.method;

              this.password = password;
              this.world = function(){
                alert(this.password);
              }
            }
            var parent = new Parent("zhangsan");
            var child = new Child("lisi","123456");
            parent.hello();
            child.hello();
            child.world();

          2、繼承第二種方式:call()方法方式
            call方法是Function類中的方法
            call方法的第一個參數的值賦值給類(即方法)中出現的this
            call方法的第二個參數開始依次賦值給類(即方法)所接受的參數

            function test(str){
              alert(this.name + " " + str);
            }
            var object = new Object();
            object.name = "zhangsan";
            test.call(object,"langsin");//此時,第一個參數值object傳遞給了test類(即方法)中出現的this,而第二個參數"langsin"則賦值給了test類(即方法)的str

            function Parent(username){
              this.username = username;
              this.hello = function(){
                alert(this.username);
              }
            }
            function Child(username,password){
              Parent.call(this,username);
             
              this.password = password;
              this.world = function(){
                alert(this.password);
              }
            }
            var parent = new Parent("zhangsan");
            var child = new Child("lisi","123456");
            parent.hello();
            child.hello();
            child.world();

          3、繼承的第三種方式:apply()方法方式
            apply方法接受2個參數,
              A、第一個參數與call方法的第一個參數一樣,即賦值給類(即方法)中出現的this
              B、第二個參數為數組類型,這個數組中的每個元素依次賦值給類(即方法)所接受的參數

            function Parent(username){
              this.username = username;
              this.hello = function(){
                alert(this.username);
              }
            }
            function Child(username,password){
              Parent.apply(this,new Array(username));
             
              this.password = password;
              this.world = function(){
                alert(this.password);
              }
            }
            var parent = new Parent("zhangsan");
            var child = new Child("lisi","123456");
            parent.hello();
            child.hello();
            child.world();

          4、繼承的第四種方式:原型鏈方式,即子類通過prototype將所有在父類中通過prototype追加的屬性和方法都追加到Child,從而實現了繼承
            function Person(){
            }
            Person.prototype.hello = "hello";
            Person.prototype.sayHello = function(){
              alert(this.hello);
            }
           
            function Child(){
            }
            Child.prototype = new Person();//這行的作用是:將Parent中將所有通過prototype追加的屬性和方法都追加到Child,從而實現了繼承
            Child.prototype.world = "world";
            Child.prototype.sayWorld = function(){
              alert(this.world);
            }
           
            var c = new Child();
            c.sayHello();
            c.sayWorld();

          5、繼承的第五種方式:混合方式
            混合了call方式、原型鏈方式

            function Parent(hello){
              this.hello = hello;
            }
            Parent.prototype.sayHello = function(){
              alert(this.hello);
            }

            function Child(hello,world){
              Parent.call(this,hello);//將父類的屬性繼承過來
              this.world = world;//新增一些屬性
            }

            Child.prototype = new Parent();//將父類的方法繼承過來

            Child.prototype.sayWorld = function(){//新增一些方法
              alert(this.world);
            }

            var c = new Child("zhangsan","lisi");
            c.sayHello();
            c.sayWorld();

          posted @ 2012-08-13 19:29 mr.zhao 閱讀(187) | 評論 (0)編輯 收藏

          2012年8月12日

           1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
           2 <html>
           3   <head>
           4     <title>MyHtml.html</title>
           5     
           6     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
           7     <meta http-equiv="description" content="this is my page">
           8     <meta http-equiv="content-type" content="text/html; charset=gbk">
           9     <script type="text/javascript">
          10         function zhuanHuan(){
          11             var dc=document.getElementById("zimu").value;
          12             var temp;
          13             var temp1 = dc.charAt(0).toUpperCase();
          14             for(var i=1;i<dc.length;i++){
          15                 temp=dc.charAt(i);
          16                 if(temp==" "&&i<dc.length-1){
          17                     temp=" "+dc.charAt(i+1).toUpperCase();
          18                     temp1=temp1+temp;
          19                     i++;
          20                 }
          21                 else{
          22                  temp1 = temp1 + temp;
          23                 }
          24             }
          25             document.getElementById("zimuhou").value=temp1;
          26         }
          27     </script>
          28   </head>
          29   
          30   <body>
          31       <div>
          32           <span>請輸入單詞:</span>
          33           <input type="text" id="zimu"/>
          34           <input type="button" value="轉換首字母大寫" onclick="zhuanHuan()"/>
          35           <input type="text" id="zimuhou" />
          36       </div>
          37   </body>
          38 </html>

          posted @ 2012-08-12 12:49 mr.zhao 閱讀(280) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 大兴区| 永善县| 壶关县| 泰兴市| 子洲县| 三亚市| 威宁| 泰和县| 荣昌县| 武定县| 三江| 安吉县| 柘荣县| 丰县| 荃湾区| 枣强县| 琼海市| 金门县| 深水埗区| 洪雅县| 郓城县| 塘沽区| 德阳市| 桦川县| 西吉县| 佛山市| 霍州市| 永福县| 五峰| 集贤县| 化州市| 中超| 海阳市| 竹山县| 威信县| 行唐县| 高碑店市| 鹤岗市| 丰宁| 镇沅| 和林格尔县|