我想显示这个,但是它不能正常工作。
document.write('<a href="/site"><img src="" alt="image"/></a> var answer =
confirm ("Please click on OK to continue loading my page, or CANCEL to be
directed to the Yahoo site.")
if (answer)
window.location="https://www.google.co.in";');
答案 0 :(得分:0)
文档和脚本是如此不同。 如果打开访问页面时确认,则可以。
<script>
window.onload = function() {
var answer = confirm ("Please click on OK to continue loading my page, or CANCEL to be directed to the Yahoo site.");
if (answer) window.location="https://www.google.co.in";
}
</script>