?  dc.id = 'bbc';wrong

解决方案 »

  1.   

    $("#objID").attr("id","你要改的id");
      

  2.   

    <input type='text' id="a">
    <input type='button' onclick="document.all('a').id='b'">
    按钮只能按一次,而且text的ID改变后在源文件里是看不出来的,但是你再次点击按钮的时候,就显示没有那个a的对象了 
      

  3.   

    document.getElemettByID("objID").id="你要的ID";
      

  4.   

    <html>
    <body>
    <div id="a"></div>
    </body>
    <script type="text/javascript" language="javascript">
    document.getElementById("a").id="b";
    alert(document.getElementById("b").id);
    </script>
    </html>在我这边测试是成功的
      

  5.   


    document.getElementById("aaa").id="ID";这样是可以的~~
      

  6.   


    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="CaiPiao.WebForm2" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title></title>
        <script type="text/javascript">
            function btnClick() {
                document.getElementById("txt").id = "tt";
                alert(document.getElementById("tt").value);//测试一下是否能够找到新修改ID之后的Textbox值。
            }
        </script>
    </head><body>
        <form id="form1" runat="server">
        <div>
        <input  id="txt" type="text" />
        <input type=button value="修改文本框ID" onclick="btnClick()" />
        </div>
        </form>
    </body>
    </html>
      

  7.   

    顶JQUERY用着舒服。目前才接触不久,哎,继续修炼去