<html>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
<script type="javascript">
function test(){
document.getElementById("sendbtn").value="yes,i do.";
}
// javascrip:test()
    </script>    <body >  
        
        <table width="100%" border="0"  height="100%">
           <tr>
            <td height="10%">
                <div align="center" style="font-weight: bold; font-style: normal; background:#FFC; font-size:16px" >刷QQ会员</div>
                <hr />
             </td>
          </tr>
          <tr>
            <td height="80%">
                <div align="center">发送代码:
                 <form>
                     <input type="text" id="sendCode" size="30">
                    </form>
                    <br/>
                    发送地址:<input type="text" id="sendNum">
                    <input type="button"  value="发送" id="sendbtn">
                </div>
            </td>
          </tr>
          <tr>
            <td height="10%">
              <table width="100%" border="0">
                  <tr>
                    <td><div align="left"><input type="button" id="UndoBtn" value="上一步" onClick="window.location.href('../index.html')"></div></td>
                    <td><div align="right"><input type="button" id="NextBtn" value="下一步" onClick=""></div></td>
                </tr>
            </table>
            </td>
          </tr>
        </table>
    </body>
</html>  
这是我的源码,我在浏览器中输入
javascrip:test()
为什么那个按的文字不会变呢?哪位大大可以教教小弟啊。

解决方案 »

  1.   

    <body>
    <table width="100%" border="0"  height="100%">
               <tr>
                <td height="10%">
                    <div align="center" style="font-weight: bold; font-style: normal; background:#FFC; font-size:16px" >刷QQ会员</div>
                    <hr />
                 </td>
              </tr>
              <tr>
                <td height="80%">
                    <div align="center">发送代码:
                        <form>
                            <input type="text" id="sendCode" size="30">
                        </form>
                        <br/>
                        发送地址:<input type="text" id="sendNum">
                        <input type="button"  value="发送" id="sendbtn">
                    </div>
                </td>
              </tr>
              <tr>
                <td height="10%">
                  <table width="100%" border="0">
                      <tr>
                        <td><div align="left"><input type="button" id="UndoBtn" value="上一步" onClick="window.location.href('../index.html')"></div></td>
                        <td><div align="right"><input type="button" id="NextBtn" value="下一步" onClick=""></div></td>
                    </tr>
                </table>
                </td>
              </tr>
            </table>
    <script language=javascript>
    alert(1);
    var test=function()
    {
        document.getElementById("sendbtn").value="yes,i do.";    
    }
    test();
    </script>
    </body>
      

  2.   

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <style>
    </style>
    </head><body>
    <table width="100%" border="0"  height="100%">
               <tr>
                <td height="10%">
                    <div align="center" style="font-weight: bold; font-style: normal; background:#FFC; font-size:16px" >刷QQ会员</div>
                    <hr />
                 </td>
              </tr>
              <tr>
                <td height="80%">
                    <div align="center">发送代码:
                        <form>
                            <input type="text" id="sendCode" size="30">
                        </form>
                        <br/>
                        发送地址:<input type="text" id="sendNum">
                        <input type="button"  value="发送" id="sendbtn">
                    </div>
                </td>
              </tr>
              <tr>
                <td height="10%">
                  <table width="100%" border="0">
                      <tr>
                        <td><div align="left"><input type="button" id="UndoBtn" value="上一步" onClick="window.location.href('../index.html')"></div></td>
                        <td><div align="right"><input type="button" id="NextBtn" value="下一步" onClick=""></div></td>
                    </tr>
                </table>
                </td>
              </tr>
            </table><script>
    function test(){
                document.getElementById("sendbtn").value="yes,i do.";    
            }
    test();
    </script>
    </body>
    </html>
    js代码没问题~·就是把script标签写在最下面就行了~·写在上面找不到对象的~·页面还没加载完~·