为什么button嵌入到iframe框架中后无法实现页面的跳转?


引入的是bootstrap框架
<link rel="stylesheet" type="text/css" href="../CSS/bootstrap.css"/>


 <script type="text/javascript" src="../js/jquery-2.0.0.min.js" ></script>
<script type="text/javascript" src="../js/bootstrap.js" ></script>

下面的是button按钮
点击事件方式


 <input type="submit" class="btn btn-primary" onClick="window.location.href='assess.html';" value="评估完成" />
a标签方式
    <input type="submit" class="btn btn-primary" href="assess.html" value="评估完成" />

iframe框架


 <iframe  id="iframepage" width="100%" height="100%" scrolling="no" frameborder="0" name="iframepage" src="quick.html" onLoad="iFrameHeight()"  >

问题:在单独的页面button按钮是可以实现链接跳转页面的,但是一旦嵌入到这个iframe中后就无法实现页面跳转了,请大家帮忙解答一下,感激不尽!!

input 前端 HTML iframe css

求扣扣求牵手 9 years, 2 months ago

因为,嵌入了iframe当中相当于嵌入了一个新的网页(在网页中打开了一个新的小浏览器),和原网页根本没有关系。所以自然是没法跳转的~

纯白的灵魂 answered 9 years, 2 months ago

iframe 里面跳转试试: window.location.replace(newUrl) ;

人类也是动物 answered 9 years, 2 months ago

Your Answer