有人可以帮我在这段代码中输入 javascript 延迟。我想让这段代码在 2 秒后打开。当您打开网址时。网站的其余部分正常加载。
<script type="text/javascript">
var avail=$z:value[article.availableinstock];
if ($z:value[article.availableinstock] < 1)
{
document.write('<div class="shop_not">');
document.write("In order!");
}
else if ($z:value[article.availableinstock] >=100)
{
document.write('<div class="shop_ok">');
document.write(" 100+ in stock" );
}
else if ($z:value[article.availableinstock] >=50 )
{
document.write('<div class="shop_ok">');
document.write(" 50+ in stock" );
}
else if ($z:value[article.availableinstock] >=25 )
{
document.write('<div class="shop_ok">');
document.write(" 25+ in stock" );
}
else
{
document.write('<div class="shop_bob">');
document.write(+ avail.toFixed(0));
document.write(" in stock" );
}
</script>