1、多个框架时,让iframe实现顺序加载。
方法一
<iframe border=0 name=lantk1 onload="lantk2.src='http://网址2/';" src="http://网址1/" width=200 height=200 allowTransparency scrollbars=yes frameBorder="0"></iframe>
<iframe border=0 name=lantk2 onload="lantk3.src='http://网址3/';" width=200 height=200 allowTransparency scrollbars=yes frameBorder="0"></iframe>
<iframe border=0 name=lantk3 onload="lantk4.src='http://网址4/';" width=200 height=200 allowTransparency scrollbars=yes frameBorder="0"></iframe>
方法二:使用js
<script type=text/javascript>
//有多少网址就写在下面,只需要修改这个地方
var urls=new Array(
'http://www.baidu.com',
'http://www.baidu.com',
'http://www.baidu.com',
'http://www.baidu.com',
'http://www.baidu.com',
'http://www.baidu.com'
);
for (i=0;i<urls.length;i++){
if (i!=urls.length-1)
document.write('<iframe border=0 name=lantk'+i+' onload="lantk'+(i+1)+'.location.href=\''+urls[i+1]+'\';" width=200 height=200 allowTransparency scrollbars=yes frameBorder="0"></iframe>');
else
document.write('<iframe border=0 name=lantk'+i+' width=200 height=200 allowTransparency scrollbars=yes frameBorder="0"></iframe>');
lantk0.location.href=urls[0];
}
</script>
2、基本一些参数
<iframe name=aa width=420 height=330 frameborder=0 scrolling=auto src=URL></iframe>
URL可以是相对路径,也可以是绝对路径
name:内嵌帧名称
width:内嵌帧宽度(可用像素值或百分比)
height:内嵌帧高度(可用像素值或百分比)
frameborder:内嵌帧边框
marginwidth:帧内文本的左右页边距
marginheight:帧内文本的上下页边距
scrolling:是否出现滚动条(“auto”为自动,“yes”为显示,“no”为不显示)
src:内嵌入文件的地址
style:内嵌文档的样式(如设置文档背景等)
allowtransparency:是否允许透明
scrolling表示是否显示页面滚动条,可选的参数为auto、yes、no,如果省略这个参数,则默认为auto。
name是iframe的名字 ,让超链接指向框架则 <a href=URL target=aa>
3.
onclick="iframe.location='http://www.baidu.com'" //名为iframe的框架打开链接
onclick="window.open('2.php?id=$id')"
得到父窗口的某一元素的值window.parent.document.getElementById('标签ID').innerHTML
window.parent.window['second'].location='2.htm';//父窗口名为second的框架显示2.htm
假设iframe链接页面为a.asp;无法预知的数据为变量b;
如果要传递参数,在iframe页面中调用b,那么是:
<iframe name="iframe_a" src="a.asp?id=<%=b%>" ></iframe>
如果是要让整个iframe页面显示b,那么是:
<iframe name="iframe_a"></iframe>
<script>
document.getElementById("iframe_a").document.body.innerHTML=<%=b%>;
</script>
--EOF--