您现在的位置是:首页 > 电脑技术查询 > web开发

使用prototype.js的有关问题

编辑:chaxungu时间:2022-10-02 23:18:57分类:web开发

使用prototype.js的问题
各位大哥,我初次使用prototype,但是以下代码一直出不来对话框,帮帮忙了
我用的是ie7.0 prototype1.5.1
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
<script src= "prototype.js " type= "text/javascript "> </script>
<script language= "javascript " type= "text/javascript ">

var Person = Class.create(); // 类的声明
Person.prototype = {
initialize: function(name) { // 构造函数
this.name = name;
}
printName: function() { // 成员函数
alert(this.name);
}
}
var persone = new Person( "Joe Smith ");// 创建实例
persone.printName(); // 函数调用
alert( "aaa ");
</script>
</head>

<body>
</body>
</html>


------解决方案--------------------
<head>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 " />
<title> 无标题文档 </title>
<script src= "prototype.js " type= "text/javascript "> </script>
<script language= "javascript " type= "text/javascript ">