<script type="text/javascript" language="javascript">
function A(){}A.prototype.b=function(str){
alert("方法b的语句:"+str);
}A.prototype.c=function(str){
var wc = this;
wc.b("我要延迟执行该方法");
window.setTimeout(function () {
alert("你就是偶的星星啦");
wc.b(str);
}, 1000);//怎么写也不对
}var x = new A;
x.c("字符");</script>
function A(){}A.prototype.b=function(str){
alert("方法b的语句:"+str);
}A.prototype.c=function(str){
var wc = this;
wc.b("我要延迟执行该方法");
window.setTimeout(function () {
alert("你就是偶的星星啦");
wc.b(str);
}, 1000);//怎么写也不对
}var x = new A;
x.c("字符");</script>
解决方案 »
- 为什么时分秒一直为0
- 求仿csdn右下角推荐代码
- 怎么知道當前是否選擇了結點
- 用javascript有没有办法获取选中字体的大小、颜色等属性
- 在IE中取出的cookie中的昵称汉字可以正确显示,但是在firefox中却是乱码?这是为何呀?如何修改?
- 如何在一页面中关闭另一页面(该页面正打开一模式窗口),春节后结贴。。。(也祝大家新年愉快!)
- 怎样用程序控制对IE中Internet选项中各种设置的修改?(谢谢,非常急用)
- 怎么做这种指向?http://search.lycos.com.cn/static.php?url=http://shopping.263.net
- 求助各位大神,我想截取这两个页面中的中文内容, 请问怎么用一个正则提取出来?
- 求Base64变形逆向
- 动态生成的radio不能设置name属性,导致不能显示选中状态,急等盼复。
- 在文本框中输入日期在另一文本框中得到星期几(速度)﹗
所以如果想正确执行,就要把this换成对象x,或者想楼上那么做也可以。
ParametersvCode Required. Variant that specifies the function pointer or string that indicates the code to be executed when the specified interval has elapsed.
iMilliSeconds Required. Integerthat specifies the number of milliseconds.
sLanguage Optional. Stringthat specifies one of the following values: JScript Language is JScript.
VBScript Language is VBScript.
JavaScript Language is JavaScript.
5555555555 我没注意 还一直以为settimeout的第一个参数只能是string
看了2楼的回复再看说明才发现 也可以是 function的变量指针
看来原来的程序要大改了 就是因为以为只能是string搞得原来的程序好复杂