history是相对整个浏览器的,不需要指定具体的窗口,直接:window.].history.back(1);即可,如:<iframe id="preview" name="preview" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" style="width: 200px; height: 300px; background-color: white" src="http://community.csdn.net/Expert/topic/5596/5596430.xml?temp=.1840174"></iframe>
<input type="button" value="go" onclick="document.frames['preview'].location='http://community.csdn.net/Expert/topic/5597/5597965.xml?temp=.7267572';">
<input type="button" value="back" onclick="window.history.back(1);">

解决方案 »

  1.   

    to dh20156(风之石):<a href="#" onclick="window.history.back(1);">返回</a>点击“返回”,第一下,没有反应,第二下,返回到前面第二个页面。
      

  2.   

    to dh20156(风之石):有一个iframe,比如<iframe id="x" name="x"></iframe>(window.frames['x].document.designMode = 'Off'),用JS的window.frames['x'].document.body.innerHTML向其中写入一些HTML代码(把此时在这个iframe中的页面称为A),这些代码中包括形如“<a href="show.php?id=2">some_text</a>”的语句。在iframe中,我点击some_text,在这个iframe中载入另一个页面(把这个页面称为B)。在show.php中,有如下PHP语句:echo '<a href="#" onclick="window.history.back(1)">返回</a>';在iframe中的页面B中,我点击“返回”,现象就是“没有反应,第二下,返回到前面第二个页面”。
      

  3.   

    但为什么,我如果把show.php中的“echo '<a href="#" onclick="window.history.back(1)">返回</a>';”这句改为“echo '<a href="#" onclick="alert(window.history.length); window.history.back(1)">返回</a>';”,会有值呢?