我的网页上有一个按钮Download
。在此按钮下,我有iframe
:
<iframe width="468px" height="60px" frameborder="0" src="http://ads.xxxxxx.com/show_ad.php?id=12535"></iframe>
当客户点击Download
按钮时,有没有办法让它有效地点击按钮下方iframe中的广告?
答案 0 :(得分:0)
根据您的情况,如果广告页面是您内部托管的内容,则可以执行以下操作:
第1页:
<button id="btn">Download</button>
<br>
<iframe width="468px" height="60px" frameborder="0" id="frm1" src="http://ads.xxxxxx.com/show_ad.php?id=12535"></iframe>
<script>
$("#btn").click(function()
{
$("#frm1").attr("src",$("#frm1").attr("src") + "&click=true");
});
</script>
第2页:(您的广告网址)
$().ready(function()
{
if(getUrlParameter('click') == true)
$("#idOfAdInPage2").click();
});
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
你可以看一下这个小提琴,以便更好地理解:http://jsfiddle.net/p5g399L1/