当然有事可以拿ux9i例子,稍微改写一下:
// Set this to true to rewrite the page
var underConstruction = true;
function rewritePage(){
if (underConstruction){
document.getElementById ('entirePage').innerHTML =
"<h1>Under construction</h1>";
}
}
的test.html
<html>
<head>
<script type="text/javascript">
window.onload = rewritePage;
</script>
<title>write example</title>
<script type="text/javascript" src="UnderConstruction.js"></script>
</head>
<body>
<div id="entirePage">
<p>Some document content.</p>
</div>
</body>
</html>
这应该做的伎俩,如果我是你,我会使用重定向,而不是这个,这里是我的意思是:
// Set this to true to rewrite the page
var underConstruction = true;
function rewritePage(){
if (underConstruction){
location.href = 'contruction.html';
}
}
保持原样。干杯
编辑
这里是如何做到这一点在PHP中,你会是所谓的网页可以说“construction.html”,现在你的PHP页面内顶部位置的代码
<?php
$redirect = 1;
if($redirect == 1){
header('Location: construction.html');
}
?>
这将直接传输/重定向你到施工页面的情况下,重定向被设置为一个..你与施工页面完成后,要么完全去除这部分程序或设置重定向到任何其他的号码1的旁边。
对不起,我刚才读这部分
如果我是用户从 page1.html到underconstruction重定向。html, 然后更改 浏览器中的网址。我希望URL保持为 page1.html对于page1,page2.html对于 page2和page3.html对于page3 ... 有没有人知道我可以如何完成 这样的任务?
你应该让其他人知道,当你编辑你的问题,你应该使用iframe中,然后,试着google一下是iframe和如何使用它。然后,您可以将上述相同的逻辑应用于iframe。
来源
2010-01-21 08:52:05
ant
我以前试过。这是我目前使用的。该方法对于在页面加载完成之前不调用该函数的事实非常有用。有没有办法在不加载原始页面的情况下执行此操作? – 2010-01-21 07:33:03