1
我想點擊javascript的幫助下的iframe鏈接,但這不起作用。 index.php加載redirect.php裏面的框架然後創建按鈕外部iframe點擊鏈接http://www.yoursite.com/。 的index.html:點擊鏈接iframe內的鏈接
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>
<script type="text/javascript">
function call() {
var allAnc = document.getElementById("d").contentDocument.getElementsByTagName("a");
for (var i = 0; i < allAnc.length; i++) {
if (allAnc[i].href.indexOf("http") > 0) {
(allAnc[i]).click();
break;
}
}
}
</script>
</head>
<body>
<input id="Button1" type="button" onclick="call()" value="button" />
<iframe id="d" src="redirect.html" width="100%" height=700"></iframe>
</body>
</html>
將redirect.html:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Avertissement de redirection</title>
<script>function go_back() {window.history.go(-1);return false;}function ctu() {var link = document && document.referrer;var esc_link = "";if (link) {var e = (window && window.encodeURIComponent) ? encodeURIComponent : escape;esc_link = e(link);}new Image().src ="/url?sa=T&url=" + esc_link + "&oi=unauthorizedredirect&ct=originlink";return false;}</script>
</head>
<body topmargin="3" bgcolor="#ffffff" marginheight="3">
<div class="a">
<div class="b">
<font size="+1"><b>Avertissement de redirection</b></font>
</div>
</div>
<div class="c">
La page que vous consultiez essaie de vous rediriger vers <a href="/url?q=http://www.yousite.com/&ei=2nPgT7uYJIP1-gb-kNiYDQ&sa=X&oi=unauthorizedredirect&ct=targetlink&ust=1340111586595170&usg=AFQjCNGP0YlzgPiD21g_9hQmBBb36l1THA">http://www.yoursite.com/</a>.
<br>
<br>
Si vous ne souhaitez pas consulter cette page, vous pouvez <a href="#" onclick="return go_back();" onmousedown="ctu();">revenir à la page précédente</a>.
<br>
<br>
<br>
</div>
</body>
</html>