天天看点

通过iframe引入另外一个项目中的html片段到项目中,解决样式,高度,兼容等问题的策略



<!--尾部开始-->

   marginheight="0" marginwidth="0" frameborder="0" scrolling="no"

   width='100%' height='392' id="iframepage" name="iframepage" onload="iframeheight()" ></iframe>

 <!--尾部结束-->

 <script language="javascript" type="text/javascript" charset="utf-8" src="js/jquery-2.1.1.js"></script>

 <script language="javascript" type="text/javascript" charset="utf-8">

  $(function(){

   $(".wj_content form table  tbody  tr  td.title").each(function(index,domele){

    $(this).text((index+1) + "、" +$(this).text());

   });

  });

function iframeheight() {

   var ifm= document.getelementbyid("iframepage");

   var subweb = document.frames ? document.frames["iframepage"].document :ifm.contentdocument;

   if(ifm != null && subweb != null) {ifm.height = subweb.body.scrollheight;}

  }

 </script>

继续阅读