我试图在我的脚本在后台运行时显示警报,但似乎发出警报以停止网站上的所有内容。有什么方法可以防止这种情况并在警报显示时使脚本运行?功能:function jobbig()
{
alert("JOBBIGT");
}
我想在警报显示时运行的代码:`
}
function changez() {
if(y == 1) {
colour = "red";
y = 2;
}
else if(y == 2)
{
colour = "green";
y = 3;
}
else if(y == 3)
{
colour = "black";
y = 4;
}
else if(y == 4)
{
colour = "yellow";
y = 5;
}
else if(y == 5)
{
colour = "cyan";
y = 6;
}
else if(y == 6)
{
colour = "white";
y = 1;
}
document.getElementById("head").style.color = colour;
}`
function change() {
if(x == 1) {
color = "black";
x = 2;
}
else if(x == 2)
{
color = "white";
x = 3;
}
else if(x == 3)
{
color = "yellow";
x = 4;
}
else if(x == 4)
{
color = "red";
x = 5;
}
else if(x == 5)
{
color = "green";
x = 6;
}
else if(x == 6)
{
color = "cyan";
x = 7;
}
else if(x == 7)
{
color = "purple";
x = 1;
}
else if(x == 1337)
{
color = "white";
}
document.body.style.background = color; }
代码运行由function andrafarg30() {
clearInterval(interval2);
clearInterval(interval3);
clearInterval(intervall2);
clearInterval(intervall3);
x = 1;
y = 1;
interval1 = setInterval(change, 30);
intervall1 = setInterval(changez, 45);
}
按钮调用。警报也由按钮调用。