本帖最后由 IL_SU 于 2009-12-05 18:29:05 编辑

解决方案 »

  1.   


    <input type="button" onClick="sEdit('<%="s" & Id%>');" value=" 修 改 " /> 
      

  2.   

    IE显示错误提示 
    getElementById(...) 为空或不是对象
      

  3.   

     <input type="button" id="<%="s"&Id%>" onClick="sEdit( <%="s"&Id%>)" value=" 修 改 " /> 
      

  4.   


    错误提示还是一样的哦现在的问题是getElementById()取不到对象<div id=" <%="s"&Id%>"> 
    而这个DIV 是动态生成的 不知道该怎么写了
      

  5.   

    你的问题:
    1.你的div去掉,div放在这里,不适合,tr下面本来应该是td,你弄个div。
     解决是:去掉div,在tr里加上id=<%%>
    2.这种方式innerHTML=某某,如果内容有新元素,是不会反应在页面中的,
    如果不会jquery,你得用creatElement()创造元素,才会反应在页面上。
    我使用了jquery:<html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>Untitled Document</title>
            <script src="js/jquery-1.3.2.min.js">
            </script>
        </head>
        <body>
         <table>
            <tr id="s">
                    <td width="5%">
                    </td>
                    <td width="30%">
                    </td>
                    <td width="18%">
                    </td>
                    <td width="18%">
                        <input type="button" onClick="sEdit('s')" value=" 修 改 " />&nbsp;&nbsp;&nbsp;
                    </td>
            </tr>
    </table>
        </body>
    </html>
    <script language="JavaScript">
        function sEdit(id){
            var s = " <td width='5%'> </td> <td width='30%'> <input type='text'id='nm' name='nm' /> </td> <td width='18%'> <input type='text' id='od' name=od /> </td> <td width='18%'> <a href='?action=save&id= <%=Id%>'>保存 </a> </td>";
            //document.getElementById(id).innerHTML = s;
    $('#'+id).html(s);
        }
    </script>