用js实现一个类,怎样在类的方法内调用alert函数?好像不能直接调用alert呀。//js
function myTree(objName, strImgPath) {
this.name = objName;
this.imgSrc = strImgPath;
}myTree.prototype.show = function(msg) {
//此处怎样调用alert函数?
}
function myTree(objName, strImgPath) {
this.name = objName;
this.imgSrc = strImgPath;
}myTree.prototype.show = function(msg) {
//此处怎样调用alert函数?
}
function myTree(objName, strImgPath) {
this.name = objName;
this.imgSrc = strImgPath;
}myTree.prototype.show = function(msg) {
alert(msg);
window.alert(this.name);
}
var mt=new myTree('kk','kk1');
mt.show('msg');
我也用window.alert(msg);做了
myTree.prototype.show = function(msg) {
window.alert(msg);
}myTree.prototype.open = function() {
this.alert("open begin");
}调用对象的open方法,但是没有弹出消息框。
myTree.prototype.open = function() {
this.show("open begin");
}
我改成了this.show也没反应。
我的这些代码放在一个js文件里面,服务用的jboss,修改js文件,怎么才能重新反映到画面应用中?
alert(msg);
window.alert(this.name);
}
,修改了js文件,重新启动服务,并且把浏览器中的缓存删除掉,
修改的js代码没有反应。