gpt4 book ai didi

javascript - 需要在 Javascript 代码上添加登陆到 _blank 以实现随机图像/链接加载脚本

转载 作者:行者123 更新时间:2023-12-03 00:58:34 27 4
gpt4 key购买 nike

我在这里有一个广告旋转器脚本,但它没有一行用于使链接在空白页面与父页面上显示。或者任何显示细节的地方。

function randomzero (n)
{
return ( Math.floor ( Math.random ( )*0.9999999999999999* (n + 1)) );}

//IV. assign any random number from 0 to 2 to x.

x = randomzero(4);


//V. display the image
document.write('<a href="http://' + randomlink[x] + '">');
document.write('<img alt="random ad banner"src="' + randompic[x] + '"/>');
document.write('</a>');

最佳答案

当然可以。将目标添加到它创建的链接:

document.write('<a target="_blank" href="http://' + randomlink[x] + '">');

关于javascript - 需要在 Javascript 代码上添加登陆到 _blank 以实现随机图像/链接加载脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52711511/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com