读书人

请教在下面的的代码中怎么修改可以实现

发布时间: 2012-03-19 22:03:05 作者: rapoo

请问在下面的的代码中如何修改可以实现点击后改变图片吗?还请各位大师多多指教,拜拖哪....


<link rel= "stylesheet " type= "text/css " href= "css.css ">
<base target= "right ">
<style type= "text/css ">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.STYLE1 {color: #000000}
-->
</style>
<script language= "javascript ">
function showdiv(div_id,img_i)
{
if(document.all.item(div_id).style.display== "block ")
{
document.all.item(div_id).style.display= "none ";
img_i.src= "pic/P1.gif ";
return true;
}
else
{
document.all.item(div_id).style.display= "block ";
img_i.src= "pic/M1.gif ";
return true;
}
return false;
}
</script>
<body>
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% ">
<tr>
<td width= "100% " height= "28 " align= "center " bgcolor= "#FFFF00 ">
<a href= "index.asp " target= "_top " class= "STYLE1 "> <b> 返回论坛首页 </b> </a> </td>
</tr>
</table>

<table border= '0 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td height= "1px ">   </td>
</tr>
</table>

<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >

<tr>
<td height= "22 " bgcolor= "#FFFF00 "> <font color= "#FFFFFF "> <b>   <img src= "pic/P1.gif " alt= "点击下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div2 ', 'img2 '); " name= "img2 " id= "img2 ">   <span class= "STYLE1 "> 论坛管理 </span> </b> </font> </td>
</tr>
</table>
<div id= "div2 " style= "display:none ">
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " height= "9 ">
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-


<a href= "admin-right.asp?action=addfl " > 添加论坛分类 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-gl.asp?menu=addbbs "> 论坛添加 </a> <a href= "admin-gl.asp?menu=bbsgl "> 管理 </a>   </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=bzgl&bz=add "> 版主添加 </a> <a href= "admin-right.asp?action=bzgl&bz=del "> 删除 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=lm "> 论坛联盟管理 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=chadmin "> 编辑管理员 </a> </td>
</tr>
</table> </div>

<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >

<tr>
<td height= "22 " bgcolor= "#FFFF00 "> <font color= "#FFFFFF "> <b>   <img src= "pic/P1.gif " alt= "点击下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div3 ', 'img3 '); " name= "img3 " id= "img3 ">   <span class= "STYLE1 "> 用户管理 </span> </b> </font> </td>
</tr>
</table>
<div id= "div3 " style= "display:none ">
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=deluser "> 删除用户 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=lookuser "> 查看注册用户 </a>   </td>


</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=updateuser "> 更改用户资料 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=seepwd "> 查看用户密码 </a> </td>
</tr>
</table> </div>

<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td height= "22 " bgcolor= "#FFFF00 "> <font color= "#FFFFFF "> <b>   <img src= "pic/P1.gif " alt= "点击下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div4 ', 'img4 '); " name= "img4 " id= "img4 ">   <span class= "STYLE1 "> 帖子管理 </span> </b> </font> </td>
</tr>
</table>
<div id= "div4 " style= "display:none ">
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " height= "9 ">
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=delany "> 批量删除帖子 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=moveany "> 批量移动帖子 </a> </td>
</tr>
</table> </div>

<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td height= "22 " bgcolor= "#FFFF00 "> <font color= "#FFFFFF "> <b>   <img src= "pic/P1.gif " alt= "点击下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div5 ', 'img5 '); " name= "img5 " id= "img5 ">   <span class= "STYLE1 "> 论坛其它 </span> </b> </font> </td>


</tr>
</table>
<div id= "div5 " style= "display:none ">
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " height= "9 ">
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=bbs "> 修改名称及其他 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=bbsmail "> 论坛留言管理 </a> </td>
</tr>
</table> </div>

<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td height= "22 " bgcolor= "#FFFF00 "> <font color= "#FFFFFF "> <b>   <img src= "pic/P1.gif " alt= "点击下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div6 ', 'img6 '); " name= "img6 " id= "img6 ">   </b> </font> <b> <span class= "STYLE1 "> 数据处理 </span> </b> </td>
</tr>
</table>
<div id= "div6 " style= "display:none ">
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " height= "9 ">
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "mdbcon.asp "> 数据库操作 </a> </td>
</tr>
</table> </div>

[解决办法]
<link rel= "stylesheet " type= "text/css " href= "css.css ">
<base target= "right ">
<style type= "text/css ">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.STYLE1 {color: #000000}
-->
</style>
<script language= "javascript ">
function showdiv(div_id,img_i)
{
if(document.all.item(div_id).style.display== "block ")
{
document.all.item(div_id).style.display= "none ";
img_i.src= "pic/P1.gif ";
return true;
}
else
{
document.all.item(div_id).style.display= "block ";


img_i.src= "pic/M1.gif ";
return true;
}
return false;
}
</script>
<body>
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% ">
<tr>
<td width= "100% " height= "28 " align= "center " bgcolor= "#FFFF00 ">
<a href= "index.asp " target= "_top " class= "STYLE1 "> <b> 返回论坛首页 </b> </a> </td>
</tr>
</table>

<table border= '0 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td height= "1px ">   </td>
</tr>
</table>

<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >

<tr>
<td height= "22 " bgcolor= "#FFFF00 "> <font color= "#FFFFFF "> <b>   <img src= "pic/P1.gif " alt= "点击下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div2 ',this); " name= "img2 " id= "img2 ">   <span class= "STYLE1 "> 论坛管理 </span> </b> </font> </td>
</tr>
</table>
<div id= "div2 " style= "display:none ">
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " height= "9 ">
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=addfl " > 添加论坛分类 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-gl.asp?menu=addbbs "> 论坛添加 </a> <a href= "admin-gl.asp?menu=bbsgl "> 管理 </a>   </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=bzgl&bz=add "> 版主添加 </a> <a href= "admin-right.asp?action=bzgl&bz=del "> 删除 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=lm "> 论坛联盟管理 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=chadmin "> 编辑管理员 </a> </td>
</tr>
</table> </div>

<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >



<tr>
<td height= "22 " bgcolor= "#FFFF00 "> <font color= "#FFFFFF "> <b>   <img src= "pic/P1.gif " alt= "点击下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div3 ',this); " name= "img3 " id= "img3 ">   <span class= "STYLE1 "> 用户管理 </span> </b> </font> </td>
</tr>
</table>
<div id= "div3 " style= "display:none ">
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=deluser "> 删除用户 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=lookuser "> 查看注册用户 </a>   </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=updateuser "> 更改用户资料 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=seepwd "> 查看用户密码 </a> </td>
</tr>
</table> </div>

<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td height= "22 " bgcolor= "#FFFF00 "> <font color= "#FFFFFF "> <b>   <img src= "pic/P1.gif " alt= "点击下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div4 ',this); " name= "img4 " id= "img4 ">   <span class= "STYLE1 "> 帖子管理 </span> </b> </font> </td>
</tr>
</table>
<div id= "div4 " style= "display:none ">
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " height= "9 ">
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=delany "> 批量删除帖子 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=moveany "> 批量移动帖子 </a> </td>
</tr>
</table> </div>

<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td height= "22 " bgcolor= "#FFFF00 "> <font color= "#FFFFFF "> <b>   <img src= "pic/P1.gif " alt= "点击下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div5 ',this); " name= "img5 " id= "img5 ">   <span class= "STYLE1 "> 论坛其它 </span> </b> </font> </td>


</tr>
</table>
<div id= "div5 " style= "display:none ">
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " height= "9 ">
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=bbs "> 修改名称及其他 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "admin-right.asp?action=bbsmail "> 论坛留言管理 </a> </td>
</tr>
</table> </div>

<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td height= "22 " bgcolor= "#FFFF00 "> <font color= "#FFFFFF "> <b>   <img src= "pic/P1.gif " alt= "点击下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div6 ',this); " name= "img6 " id= "img6 ">   </b> </font> <b> <span class= "STYLE1 "> 数据处理 </span> </b> </td>
</tr>
</table>
<div id= "div6 " style= "display:none ">
<table border= '1 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " height= "9 ">
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap ">   |-
<a href= "mdbcon.asp "> 数据库操作 </a> </td>
</tr>
</table> </div>

读书人网 >JavaScript

热点推荐