var sloth = {};
sloth.xxx = function() {
alert("xxx");
};
sloth.xxx();在这看到的:
http://wyz.67ge.com/google-js/javascriptguide.xml#%E5%91%BD%E5%90%8D
sloth.xxx = function() {
alert("xxx");
};
sloth.xxx();在这看到的:
http://wyz.67ge.com/google-js/javascriptguide.xml#%E5%91%BD%E5%90%8D
var sloth = {};
sloth.xxx = function() {
alert("xxx");
};
放到js文件中了,然后在html文件中用script引用这个js,然后在html文件中使用
sloth.xxx();
没有效果。
我试了一下全都在一个html确实是没有问题的。我再试试。
var sloth = {};
sloth.xxx = function() {
alert("xxx");
};
放到js文件中了,然后在html文件中用script引用这个js,然后在html文件中使用
sloth.xxx();
没有效果。
我试了一下全都在一个html确实是没有问题的。我再试试。单独这样也没问题,但在我的实际的代码里就有问题,好像问题在我的代码有问题。
var sloth = {};
sloth.xxx = function() {
alert("xxx");
};
后面又加了
var sloth.yyy = "asfd";
因为是从之前的代码改成命名空间风格的,所以没有把var去掉。另外我对javascript也不是很熟。