document.getElementById("sendsp").innertext = "赋值";document.getElementById("sendsp").innerText = "赋值";

解决方案 »

  1.   

    <script language="javascript">
      function s(){
    document.getElementById("sendsp").innerText = "赋值";}
      </script>
    <body onload="s()">
        <span id="sendsp"></span>
    </body>
      

  2.   

    script那段写在span的后面
    读取有先后,还没生成span的情况下是取不到它的id的
      

  3.   


            <span   id= "sendsp "> </span> 
    <script   language= "javascript "> 
        <!-- 
    document.getElementById( "sendsp ").innertext   =   "赋值 "; 
          --> 
        </script> 
    这样写就可以鸟
      

  4.   

    将:document.getElementById( "sendsp ").innertext   =   "赋值 "; 
    改为:document.getElementById( "sendsp ").innerText   =   "赋值 "; 
    注意区分大小写!!!!
      

  5.   

    innertText 注意区分大小写就可以了
      

  6.   

    楼主的代码有两处错误:
    <script   language= "javascript "> 
        <!-- 
    document.getElementById( "sendsp ").innertext   =   "赋值 "; 
          --> 
        </script> 
            <span   id= "sendsp "> </span> 我象这么写总是错的,是为什么?错误1.JavaScript区分大小写,innertext和innerText不一样;
    错误2.程序是顺序执行,当程序运行到document.getElementById( "sendsp ").innertext   =   "赋值 "; 时,sendsp还没有定义;
        修改方法:
        方法1.如2楼的;
        方法2.如5楼的;
      

  7.   

    <script   language= "javascript"> 
    function sendvalue()
    {
       document.getElementById("sendsp").innerText="赋值";
    }
    </script> 
     <body onload="sendvalue()">
     <span   id="sendsp"></span> 
    或者把innerText改成innerHTML也可以用。
      

  8.   

    document.getElementById( "sendsp ").innerHTML=value;
    FF 也支持!!!
      

  9.   

    FF B3的支持innerText,2的好象不支持.
    不过可以用textContent
      

  10.   

    document.all( "sendsp ").innerHTML=value;或是用节点的方式添加也可以