一个Javascript考试题目及我的答案

第二部分:JavaScript部分

使用面向对象思想实现,验证的过程。

面向对象提示:

function ootest(name,age)
{
    this.name=name;
    this.age=age;
    this.myalert();
}
ootest.prototype.myalert=function()
{
    alert("姓名:"+this.name+"  年龄:"+this.age); 
}
调用
var ootest=new ootest("张三","23");


要求:

一个页面,有两个textbox控件,两个button控件,如:

       
       

       
       


实现只是通过实力化一个类,即可实现验证的目的。输入两个参数,其中一个是控件的id,另一个是提示信息.

〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉〉以下答案〉〉〉〉〉〉〉〉〉〉〉〉

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="alert.aspx.cs" Inherits="alert" %>



    Untitled Page
  


   


   

       
       

       
           
   

   



 

你可能感兴趣的:(代码杂记,javascript,textbox,button,asp,function,server)