sách gpt4 ai đã đi

Tham số Javascript

In lại 作者:行者123 更新时间:2023-11-30 07:05:48 30 4
mua khóa gpt4 Nike

我输入 scroll(0,10,200,10);但是当它运行时,它会传递字符串“xxpos”或“yypos”,我确实在没有撇号的情况下尝试过,但它就是行不通。

scroll = function(xpos,ypos,time,rounds){
var xxpos = xpos*1;
var yypos = ypos*1;
var rrounds = rounds*1;
var ttime = time*1;
x = 0;
xyz=window.setInterval("scroller('xxpos','yypos','ttime','rrounds')",ttime);
}
function scroller(xpos,ypos,time,rounds){
alert(xpos + ypos + time + rounds);
}

1 Câu trả lời

不要使用字符串,使用闭包(匿名函数)。

window.setTimeout(function() {
scroller(xxpos, yypos, ttime, rrounds);
}, ttime);

关于Javascript 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9879495/

30 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com