<span>
<script type="text/javascript">
document.write('<iframe src="http://example.com/index.php?m=member&c=index&a=mini&forward=' + encodeURIComponent(location.href) + '&siteid=1" allowTransparency="true" width="500" height="24" frameborder="0" scrolling="no"></iframe>')
</script>
</span>
phpcms开源系统中有这样的一行代码。其实就是输出一个iframe框架,使用document.write来写和直接写一个iframe不是一样的吗,或者说这样做可以延迟加载,或者有其他的什么原因呢?
直接使用HTML方式话,iframe的URL动态设置是一个问题呢
当然你也可以使用在后台渲染好一个包含 ifrmae HTML返回也是可以的
只是使用这个方式方便些document.write
会把真个页面重置-只包含一个iframe
其实没有什么的,换成你写成HTML也能照样运行~~~
是因为他的变量在js里,所以用的js渲染的