gpt4 book ai didi

javascript - 如何在不点击的情况下运行这个脚本?

转载 作者:行者123 更新时间:2023-11-30 16:41:14 26 4
gpt4 key购买 nike

This question is based on this question; but, there are some differences.


我的 friend 有一个在线网页,它有一个内联脚本标签,有一个JavaScript函数:

(#1):

var domain = window.location.protocol + "//" + window.location.host + '/';

$(document).ready(function() {
var count = 5;
countdown = setInterval(function() {
if (count == 0) {
$('#countdow').hide();
$('#link-news').show()
} else {
$('#countdow').text(count);
count--
}
}, 1700);
$('#link-news').click(function() {
var urls = $('input[name=linknexttop]').val();
if (urls == 1) {
$('input[name=linknexttop]').val(2);
$.ajax({
type: "GET",
url: domain + "click.html",
data: "code=Sh9QA&token=0982ff3066a3c60dbd3ecf9bcafc801b",
contentType: "application/json; charset=utf-8",

success: function(html) {
//alert(html);
window.location = html;
}
})
}
})
});

等待5秒后,会显示:

(#2):

 <div id="countdow">Please wait ...</div>
<a href="javascript:(0)" onClick="return false" id="link-news" style="display:none;"><img src="en_tran.png" border="0" name="imgTag" /></a>
</div>

现在,我想将数据发送到 click.html(在 #1 中),无需点击进入图像 imgTag(在 #2 中)。有可能用 JavaScript 实现吗?


Rule for playing: "I am allowed to insert my code bellow his original code only; so, I am not allowed to change anything in his code. And, the most important: code=Sh9QA&token=0982ff3066a3c60dbd3ecf9bcafc801b is random.".


最佳答案

您可以通过在5 秒倒计时。

或者直接在点击函数中调用ajax调用

    if (count == 0) {
$('#countdow').hide();
$('#link-news').show();
$('#link-news').click(); /* This will trigger the click event without actually clicking on the image */
} else {
$('#countdow').text(count);
count--
}

关于javascript - 如何在不点击的情况下运行这个脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31956293/

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