DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> 關於JavaScript >> 點擊隱藏頁面左欄或右欄實現js代碼
點擊隱藏頁面左欄或右欄實現js代碼
編輯:關於JavaScript     
點擊隱藏頁面左欄或右欄(同一TABLE中)
復制代碼 代碼如下:
<style type="text/css">
<!--
.navPoint {COLOR: white; CURSOR: hand; FONT-FAMILY: Webdings; FONT-SIZE: 9pt}
.STYLE1 {FONT-FAMILY: Webdings; FONT-SIZE: 9pt; cursor: hand;}
-->
</style>
<script>
function switchSysBar(){
if (switchPoint.innerText==3){
switchPoint.innerText=4
document.all("frmTitle").style.display="none"
}else{
switchPoint.innerText=3
document.all("frmTitle").style.display=""
}}
</script>
<table border="0" cellPadding="0" cellSpacing="0" height="100%" width="100%">
<tr>
<td width="20%" align="middle" vAlign="center" noWrap bgcolor="#CC99FF" id="frmTitle" name="frmTitle"> </td>
<td class=a2 style="WIDTH: 9pt"><table border="0" cellPadding="0" cellSpacing="0" height="100%">
<tr>
<td style="HEIGHT: 100%" onClick="switchSysBar()"><font style="FONT-SIZE: 9pt; CURSOR: default; COLOR: #ffffff"> <br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<font color="#FF0000"><br/>
<br/>
<br/>
<br/>
<br/>
<span class="STYLE1" id="switchPoint" title="關閉/打開左欄">3</span><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</font><br/>
<br/>
屏幕切換 </font></td>
</tr>
</table></td>
<td bgcolor="#FFCC99" style="WIDTH: 100%"> </td>
</tr>
</table>
想把隱藏左右欄的那個按鈕按成圖片,改一下JS,IMG增加ID,這裡id=aa,也可以換成其它的名稱,參考如下:
<script>
function switchSysBar(){
if (document.all.aa.src.indexOf("bl_1")!=-1){
aa.src="images/al_1.gif"
document.all("frmTitle").style.display="none"
}else{
aa.src="images/bl_1.gif"
document.all("frmTitle").style.display=""
}
}
</script>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="770" valign="top"> </td>
<td width="10" onClick="switchSysBar()"><img id="aa" src="images/bl_1.gif" title="關閉/打開功能導航"></td>
<td width="191" valign="top" id="frmTitle" name="frmTitle"> </td>
</tr>
</table>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved