【发布时间】:2015-08-12 13:07:30
【问题描述】:
本题基于this question;但是,存在一些差异。
我朋友有一个在线网页,里面有一个内嵌脚本标签,还有一个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 做到这一点?
游戏规则:“我只能在他的原始代码下面插入我的代码;所以,我不能更改他的代码中的任何内容。最重要的是:
code=Sh9QA&token=0982ff3066a3c60dbd3ecf9bcafc801b是随机的。”。
【问题讨论】:
-
你想在图片上调用点击事件而不点击图片吗?
标签: javascript jquery html ajax json