- 昵 称: (必填)
- QQ 号: (必填)
- 评 论: (必填5-250字)
- 验证码: (必填)
用JS来实现iframe 的标准化.
一、建立一个JS文件,代码如下:
function ifr(url,w,h){document.write('<iframe id="ifr" name="ifr" width="'+w+'" height="'+h+'" border="0" frameborder="0" scrolling="no" src="'+url+'"></iframe>');}
保存成"ifr.js"
二、在网页中插入代码
<script type="text/javascript" src="ifr.js"></script>
三、在需要使用iframe的地方插入代码
<script type="text/javascript">ifr('http://www.fun52.com/','778','120');</script>
函数ifr()使用说明:ifr('这里写地址','这里写宽度','这里写长度',)