一、iframe实现局部刷新方法一

<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="#" >1</a>
<a href="#" >2</a>
<iframe src="" ></iframe>

 当点a1时在iframe里显示a1.html的内容,点a2时在iframe里显示a2.html的内容


二、iframe实现局部刷新的方法二

<a href="a1.html" >1</a>
<a href="a2.html" >2</a>
<iframe src="" ></iframe>

 

备注: <form> 同样也有target属性,作用和<a>一样 这个方式如果<from>或<a>提交到某个Action中再跳转到a1.html中效果一样,如果在Action中有req.set或session.set,最后在iframe中同样可以显示出来。

相关文章:

  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-03
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-27
  • 2021-07-31
  • 2021-12-29
  • 2021-09-08
  • 2022-01-24
  • 2022-01-12
相关资源
相似解决方案