用代码来充实生活

梦想遥不可及
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 阅读(210) | 评论 (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 阅读(170) | 评论 (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 阅读(261) | 评论 (0)编辑 收藏