首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

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

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

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


<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 "> &nbsp; </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> &nbsp; <img   src= "pic/P1.gif "   alt= "点击下拉 "   width= "20 "   height= "20 "   align= "absmiddle "     language= "javascript "   onClick= "showdiv( 'div2 ', 'img2 '); "   name= "img2 "   id= "img2 "> &nbsp; <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 ">   &nbsp;&nbsp;|-  


        <a   href= "admin-right.asp?action=addfl "   > 添加论坛分类 </a> </td>
    </tr>
    <tr>
        <td   width= "100% "   height= "26 "   nowrap= "nowrap ">     &nbsp;&nbsp;|-  
        <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 ">     &nbsp;&nbsp;|-  
        <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 ">   &nbsp;   |-  
        <a   href= "admin-right.asp?action=lm "> 论坛联盟管理 </a> </td>
    </tr>
    <tr>
        <td   width= "100% "   height= "26 "   nowrap= "nowrap ">   &nbsp;   |-  
        <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> &nbsp; <img   src= "pic/P1.gif "   alt= "点击下拉 "   width= "20 "   height= "20 "   align= "absmiddle "     language= "javascript "   onClick= "showdiv( 'div3 ', 'img3 '); "   name= "img3 "   id= "img3 "> &nbsp; <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 ">   &nbsp;   |-  
        <a   href= "admin-right.asp?action=deluser "> 删除用户 </a> </td>
    </tr>
    <tr>
        <td   width= "100% "   height= "26 "   nowrap= "nowrap ">   &nbsp;   |-  
        <a   href= "admin-right.asp?action=lookuser "> 查看注册用户 </a>   </td>


    </tr>
    <tr>
        <td   width= "100% "   height= "26 "   nowrap= "nowrap ">     &nbsp;&nbsp;|-  
        <a   href= "admin-right.asp?action=updateuser "> 更改用户资料 </a> </td>
    </tr>
    <tr>
        <td   width= "100% "   height= "26 "   nowrap= "nowrap ">     &nbsp;&nbsp;|-  
        <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> &nbsp; <img   src= "pic/P1.gif "   alt= "点击下拉 "   width= "20 "   height= "20 "   align= "absmiddle "     language= "javascript "   onClick= "showdiv( 'div4 ', 'img4 '); "   name= "img4 "   id= "img4 "> &nbsp; <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 ">     &nbsp;&nbsp;|-  
        <a   href= "admin-right.asp?action=delany "> 批量删除帖子 </a> </td>
    </tr>
    <tr>
        <td   width= "100% "   height= "26 "   nowrap= "nowrap ">     &nbsp;&nbsp;|-  
        <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> &nbsp; <img   src= "pic/P1.gif "   alt= "点击下拉 "   width= "20 "   height= "20 "   align= "absmiddle "     language= "javascript "   onClick= "showdiv( 'div5 ', 'img5 '); "   name= "img5 "   id= "img5 "> &nbsp; <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 ">   &nbsp;   |-  
        <a   href= "admin-right.asp?action=bbs "> 修改名称及其他 </a> </td>
    </tr>
    <tr>
        <td   width= "100% "   height= "26 "   nowrap= "nowrap ">     &nbsp;&nbsp;|-  
        <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> &nbsp; <img   src= "pic/P1.gif "   alt= "点击下拉 "   width= "20 "   height= "20 "   align= "absmiddle "     language= "javascript "   onClick= "showdiv( 'div6 ', 'img6 '); "   name= "img6 "   id= "img6 "> &nbsp; </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 ">     &nbsp;&nbsp;|-  
        <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> 返回&#35770;&#22363;首&#39029; </b> </a> </td>
</tr>
</table>

<table border= '0 ' cellpadding= '0 ' cellspacing= '0 ' style= 'border-collapse: collapse ' bordercolor= '#FF9900 ' width= "95% " >
<tr>
<td height= "1px "> &nbsp; </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> &nbsp; <img src= "pic/P1.gif " alt= "点&#20987;下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div2 ',this); " name= "img2 " id= "img2 "> &nbsp; <span class= "STYLE1 "> &#35770;&#22363;管理 </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 "> &nbsp;&nbsp;|-
<a href= "admin-right.asp?action=addfl " > 添加&#35770;&#22363;分&#31867; </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap "> &nbsp;&nbsp;|-
<a href= "admin-gl.asp?menu=addbbs "> &#35770;&#22363;添加 </a> &middot; <a href= "admin-gl.asp?menu=bbsgl "> 管理 </a>   </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap "> &nbsp;&nbsp;|-
<a href= "admin-right.asp?action=bzgl&bz=add "> 版主添加 </a> &middot; <a href= "admin-right.asp?action=bzgl&bz=del "> &#21024;除 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap "> &nbsp; |-
<a href= "admin-right.asp?action=lm "> &#35770;&#22363;&#32852;盟管理 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap "> &nbsp; |-
<a href= "admin-right.asp?action=chadmin "> &#32534;&#36753;管理&#21592; </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> &nbsp; <img src= "pic/P1.gif " alt= "点&#20987;下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div3 ',this); " name= "img3 " id= "img3 "> &nbsp; <span class= "STYLE1 "> 用&#25143;管理 </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 "> &nbsp; |-
<a href= "admin-right.asp?action=deluser "> &#21024;除用&#25143; </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap "> &nbsp; |-
<a href= "admin-right.asp?action=lookuser "> &#26597;看注册用&#25143; </a>   </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap "> &nbsp;&nbsp;|-
<a href= "admin-right.asp?action=updateuser "> 更改用&#25143;&#36164;料 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap "> &nbsp;&nbsp;|-
<a href= "admin-right.asp?action=seepwd "> &#26597;看用&#25143;密&#30721; </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> &nbsp; <img src= "pic/P1.gif " alt= "点&#20987;下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div4 ',this); " name= "img4 " id= "img4 "> &nbsp; <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 "> &nbsp;&nbsp;|-
<a href= "admin-right.asp?action=delany "> 批量&#21024;除帖子 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap "> &nbsp;&nbsp;|-
<a href= "admin-right.asp?action=moveany "> 批量移&#21160;帖子 </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> &nbsp; <img src= "pic/P1.gif " alt= "点&#20987;下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div5 ',this); " name= "img5 " id= "img5 "> &nbsp; <span class= "STYLE1 "> &#35770;&#22363;其它 </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 "> &nbsp; |-
<a href= "admin-right.asp?action=bbs "> 修改名称及其他 </a> </td>
</tr>
<tr>
<td width= "100% " height= "26 " nowrap= "nowrap "> &nbsp;&nbsp;|-
<a href= "admin-right.asp?action=bbsmail "> &#35770;&#22363;留言管理 </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> &nbsp; <img src= "pic/P1.gif " alt= "点&#20987;下拉 " width= "20 " height= "20 " align= "absmiddle " language= "javascript " onClick= "showdiv( 'div6 ',this); " name= "img6 " id= "img6 "> &nbsp; </b> </font> <b> <span class= "STYLE1 "> 数据&#22788;理 </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 "> &nbsp;&nbsp;|-
<a href= "mdbcon.asp "> 数据&#24211;操作 </a> </td>
</tr>
</table> </div>

热点排行