<table cellspacing="4" cellpadding="4" width="100%" class="infotable" style="margin-left:52px">
        <tr>
          <td><input type="button" name="clickbutton[]" value="上传图片" class="button" id="button" onclick="edit_album_show('pic')">
            <input type="button" name="clickbutton[]" value="插入图片" class="button" onclick="edit_album_show('album')"></td>
        </tr>
      </table>这里我点击一下上传图片或插入图片都是说缺少对象,而且调用下面的函数时不会ALERT,不知道是什么的原因,请高手给我指点一下
function edit_album_show(id) {alert(id);
var obj = $('uchome-edit-'+id);
if(id == 'album') {
$('uchome-edit-pic').style.display = 'none';
}
if(id == 'pic') {
$('uchome-edit-album').style.display = 'none';
}
if(obj.style.display == '') {
obj.style.display = 'none';
} else {
obj.style.display = '';
}
}

解决方案 »

  1.   

    这个应该去JS或者前台的区吧,这里好像是PHP的区
      

  2.   

    $('uchome-edit-pic').style.display = 'none';  $('uchome-edit-pic')这个要是个dom对象
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <link href="css.css" rel="stylesheet" type="text/css" />
    <style type="text/css"></style>
    <script language="javascript" type="text/javascript">
    function edit_album_show(id) {alert(id);
    var oo=document.getElementById("aa");
    oo.style.display="none";}
    </script>
    </head>
     <body>
      <table cellspacing="4" cellpadding="4" width="100%" class="infotable" style="margin-left:52px">
      <tr>
      <td><input type="button" name="clickbutton[]" value="上传图片" class="button" id="button" onclick="edit_album_show('pic')">
      <input type="button" name="clickbutton[]" value="插入图片" class="button" onclick="edit_album_show('album')"></td>
      </tr>
      </table>
      <div id="aa" style="color:red;" >
      aa
      </div>
     </body>
    </html>