<html>
<head>
<title>
information
</title>
</head>
<script language=JavaScript>
function show()
{
window.alert( "this.info ");
}
function myInformation(a,b,c)
{ this.pro=a;
this.city=b;
this.road=c;
this.info= "地址是 "+this.pro+this.city+this.road;
this.show=show;
}
var abc=new myInformation( "安徽省 ", "合肥市 ", "人民路 ");
</script>
<body>
<form>
<input type= "button " value= "我的地址显示 " onclick=abc.show() ">
</form>
</body>
</html>
------解决方案--------------------
函数的参数不用定义参数类型吗?
------解决方案--------------------
<html>
<head>
<title>
information
</title>
</head>
<script language=JavaScript>
function show()
{
window.alert(this.info); //为什么要加引号?
}
function myInformation(a,b,c)
{ this.pro=a;
this.city=b;
this.road=c;
this.info= "地址是 "+this.pro+this.city+this.road;
this.show=show;
}
var abc=new myInformation( "安徽省 ", "合肥市 ", "人民路 "); //发现中文逗号
</script>
<body>
<form>
<input type= "button " value= "我的地址显示 " onclick= "abc.show() "> //少了一个双引号,
</form>
</body>
</html>
------解决方案--------------------
如果是null就是未定以