Code
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-cn">
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
//<![CDATA[
function classTest(){
var name,sex,age;
this.setName=function(x){
name=x;
}
this.setSex=function(x){
sex=x;
}
this.setAge=function(x){
age=x;
}
this.getName=function(){
return name;
}
this.getSex=function(){
return sex;
}
this.getAge=function(){
return age;
}
}
var person=new classTest();
person.setName("毛凌志");
person.setSex("男");
person.setAge(27);
alert(person.getName()+"\n"+person.getSex()+"\n"+person.getAge())
//]]>
</script>
</body>
</html>
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-cn">
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
//<![CDATA[
function classTest(){
var name,sex,age;
this.setName=function(x){
name=x;
}
this.setSex=function(x){
sex=x;
}
this.setAge=function(x){
age=x;
}
this.getName=function(){
return name;
}
this.getSex=function(){
return sex;
}
this.getAge=function(){
return age;
}
}
var person=new classTest();
person.setName("毛凌志");
person.setSex("男");
person.setAge(27);
alert(person.getName()+"\n"+person.getSex()+"\n"+person.getAge())
//]]>
</script>
</body>
</html>
js中的正则
var re=new RegExp('(^| )'+"te"+'( |$)');
alert(re.test("abc te"));