一、方法一
<script type="text/javascript">
$(function(){
$("#a1").click(function(){
var name= $(this).attr("name");
$("#iframe").attr("src",name).ready();
})
$("#a2").click(function(){
var name= $(this).attr("name");
$("#iframe").attr("src",name).ready();
})
})
</script>
<a href="#" id="a1" name="a1.html">1</a>
<a href="#" id="a2" name="a2.html">2</a>
<iframe src="" id="iframe"></iframe>
二 方法2
<a href="a1.html" id="a1" name="a1.html" target="i">1</a>
<a href="a2.html" id="a2" name="a2.html" target="i">2</a>
<iframe src="" id="iframe" name="i"></iframe>
备注: 同样也有target属性,作用和一样 这个方式如果或提交到某个Action中再跳转到a1.html中效果一样,如果在Action中有req.set或session.set,最后在iframe中同样可以显示出来。
转载:https://blog.csdn.net/u012865381/article/details/53306690?utm_source=blogxgwz1