<div class="htmlarea"> <textarea id="runcode74282"> <script language="javascript"><!-- function old_page() { window.location = "http://www.jb51.net" } function replace() { window.location.replace("http://www.jb51.net") } function new_page() { window.open("http://www.jb51.net") } // --></script> <input type="button" onclick="new_page()" value="new_page"> <input type="button" onclick="old_page()" value="old_page"> <input type="button" onclick="replace()" value="replace"> </textarea><br><input onclick="runEx('runcode74282')" type="button" value="运行代码"> <input onclick="doCopy('runcode74282')" type="button" value="复制代码"> <input onclick="doSave(runcode74282)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div> <br><strong>window.location和window.open的区别</strong> <br>window.location = "http://www.jb51.net" 跳转后有后退功能 <br>window.location.replace("http://www.jb51.net") 跳转后没有后退功能 <br>window.open("http://www.jb51.net") 要新的窗口打开链接