JS與框架頁的操作代碼
更新時間:2010年01月17日 22:14:27 作者:
JS與框架頁的操作函數(shù)代碼,多用于控制框架頁,一般后臺利用的比較多。
1,刷新框架
onload=function()
{
try
{
parent.Link.location.reload();
}
catch(e)
{
}
}
2,獲取URL并字符處理
var url=parent.frames["right"].location.href;
//document.write('<Font size="2" color="red">'+url+"</Font>");
url=url.substring(url.indexOf("TBSW")+21,url.length);
3,設(shè)置Title
top.frames.left.document.title=url;
3,關(guān)閉頂則
<script type="text/javascript">
<!--
function ctrl()
{
var img=document.getElementById("imgctop");
var mainfrm=top.parent.window.frames["Frame"];
//alert (mainfrm);
if(mainfrm.rows == "55,*")
{
mainfrm.rows = "0,*";
img.src="Images/topopen.jpg";
img.alt="展開頂則";
}
else
{
mainfrm.rows = "55,*";
img.src="Images/topclose.jpg";
img.alt="關(guān)閉頂則";
}
}
//-->
</script>
4,左右則
<script type="text/javascript">
<!--
function ctrl()
{
var img=document.getElementById("imgctrl");
if(parent.document.all.bottom.cols == "170,7,*")
{
parent.document.all.bottom.cols = "0,7,*";
img.src="Images/open.jpg";
img.alt="展開左則";
}
else
{
parent.document.all.bottom.cols = "170,7,*";
img.src="Images/close.jpg";
img.alt="關(guān)閉左則";
}
}
//-->
</script>
復(fù)制代碼 代碼如下:
onload=function()
{
try
{
parent.Link.location.reload();
}
catch(e)
{
}
}
2,獲取URL并字符處理
復(fù)制代碼 代碼如下:
var url=parent.frames["right"].location.href;
//document.write('<Font size="2" color="red">'+url+"</Font>");
url=url.substring(url.indexOf("TBSW")+21,url.length);
3,設(shè)置Title
top.frames.left.document.title=url;
3,關(guān)閉頂則
復(fù)制代碼 代碼如下:
<script type="text/javascript">
<!--
function ctrl()
{
var img=document.getElementById("imgctop");
var mainfrm=top.parent.window.frames["Frame"];
//alert (mainfrm);
if(mainfrm.rows == "55,*")
{
mainfrm.rows = "0,*";
img.src="Images/topopen.jpg";
img.alt="展開頂則";
}
else
{
mainfrm.rows = "55,*";
img.src="Images/topclose.jpg";
img.alt="關(guān)閉頂則";
}
}
//-->
</script>
4,左右則
復(fù)制代碼 代碼如下:
<script type="text/javascript">
<!--
function ctrl()
{
var img=document.getElementById("imgctrl");
if(parent.document.all.bottom.cols == "170,7,*")
{
parent.document.all.bottom.cols = "0,7,*";
img.src="Images/open.jpg";
img.alt="展開左則";
}
else
{
parent.document.all.bottom.cols = "170,7,*";
img.src="Images/close.jpg";
img.alt="關(guān)閉左則";
}
}
//-->
</script>
相關(guān)文章
利用JavaScript實現(xiàn)簡單3D開關(guān)書本模型
這篇文章主要為大家詳細(xì)介紹了如何利用JavaScript實現(xiàn)簡單3D開關(guān)書本模型的效果,文中的實現(xiàn)代碼講解的非常詳細(xì),具有一定參考價值,感興趣的同學(xué)可以動手嘗試一下2023-11-11