用代碼來充實生活

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

          2012年8月19日

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

              1、開放的源代碼:

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

              2、PHP是免費的。

            和其它技術(shù)相比,PHP本身免費。

              3、php的快捷性

            程序開發(fā)快,運(yùn)行快,技術(shù)本身學(xué)習(xí)快。嵌入于HTML:因為PHP可以被嵌入于HTML語言,它相對于其他語言。編輯簡單,實用性強(qiáng),更適合初學(xué)者。

              4、跨平臺性強(qiáng):

            由于PHP是運(yùn)行在服務(wù)器端的腳本,可以運(yùn)行在UNIXLINUXWINDOWS下。

              5、效率高:

            PHP消耗相當(dāng)少的系統(tǒng)資源

              6、圖像處理:

            用PHP動態(tài)創(chuàng)建圖像

              7、面向?qū)ο螅?/span>

            在php4,php5 中,面向?qū)ο蠓矫娑加辛撕艽蟮母倪M(jìn),現(xiàn)在php完全可以用來開發(fā)大型商業(yè)程序。

              8、專業(yè)專注:

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

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





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

          2012年8月13日

          js繼承有5種實現(xiàn)方式:
          1、繼承第一種方式:對象冒充
            function Parent(username){
              this.username = username;
              this.hello = function(){
                alert(this.username);
              }
            }
            function Child(username,password){
              //通過以下3行實現(xiàn)將Parent的屬性和方法追加到Child中,從而實現(xiàn)繼承
              //第一步:this.method是作為一個臨時的屬性,并且指向Parent所指向的對象,
              //第二步:執(zhí)行this.method方法,即執(zhí)行Parent所指向的對象函數(shù)
              //第三步:銷毀this.method屬性,即此時Child就已經(jīng)擁有了Parent的所有屬性和方法
              this.method = Parent;
              this.method(username);//最關(guān)鍵的一行
              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方法的第一個參數(shù)的值賦值給類(即方法)中出現(xiàn)的this
            call方法的第二個參數(shù)開始依次賦值給類(即方法)所接受的參數(shù)

            function test(str){
              alert(this.name + " " + str);
            }
            var object = new Object();
            object.name = "zhangsan";
            test.call(object,"langsin");//此時,第一個參數(shù)值object傳遞給了test類(即方法)中出現(xiàn)的this,而第二個參數(shù)"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個參數(shù),
              A、第一個參數(shù)與call方法的第一個參數(shù)一樣,即賦值給類(即方法)中出現(xiàn)的this
              B、第二個參數(shù)為數(shù)組類型,這個數(shù)組中的每個元素依次賦值給類(即方法)所接受的參數(shù)

            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,從而實現(xiàn)了繼承
            function Person(){
            }
            Person.prototype.hello = "hello";
            Person.prototype.sayHello = function(){
              alert(this.hello);
            }
           
            function Child(){
            }
            Child.prototype = new Person();//這行的作用是:將Parent中將所有通過prototype追加的屬性和方法都追加到Child,從而實現(xiàn)了繼承
            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 閱讀(189) | 評論 (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="轉(zhuǎn)換首字母大寫" onclick="zhuanHuan()"/>
          35           <input type="text" id="zimuhou" />
          36       </div>
          37   </body>
          38 </html>

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

          主站蜘蛛池模板: 八宿县| 宁南县| 沾益县| 神池县| 额济纳旗| 贺州市| 日喀则市| 大同市| 黑河市| 姜堰市| 江西省| 和田县| 五家渠市| 丰原市| 关岭| 迭部县| 伊宁市| 松桃| 板桥市| 阿拉尔市| 比如县| 新野县| 奉贤区| 杂多县| 吉水县| 锦屏县| 西丰县| 甘泉县| 池州市| 琼海市| 星座| 嘉定区| 岐山县| 杭锦旗| 祁东县| 凌云县| 枣阳市| 江口县| 华宁县| 元阳县| 永平县|