<script language="javascript">
function window.onload()
{
 alert(document.fileSize);
}
</script>

解决方案 »

  1.   

    <input type="button" value="显示字数" onclick="javascript:alert(document.body.innerText);alert(document.body.innerText.length)">
      

  2.   

    向onestab()请教,能否不用按钮,当打开网页时在网页上自动显示字数
      

  3.   

    <body onload="window.status=
    document.body.innerText.length">
    向onestab()请教,能否不用按钮,当打开网页时在网页上自动显示字数
      

  4.   

    向qiushuiwuhen(秋水无恨)问好,能否将显示的数字放在网页中的任何位置?谢了。
      

  5.   

    onestab(),按你的方法,如何避免将空格和回车计算到字数里?
      

  6.   

    <BODY>
    <p>word count:<span id=wordcount></span></p>
    .......
    .......
    .......
    .
    .
    <script>
    str = document.body.innerText;
    var s,len;
    s = len = str.length;
    for(var i=0; i<len;i++){
    c = str.charAt(i);
    if(c=="\n" || c==" " || c=="\t") s--;
    }
    wordcount.innerText = s;
    </script>
    </BODY>
      

  7.   

    <BODY>
    <p>word count:<span id=wordcount></span></p>
    .......
    .......
    .......
    .
    .
    <script>
    str = document.body.innerText;
    wordcount.innerText = str.replace(/\s/g,"").length;
    </script>
    </BODY>
      

  8.   

    PFPF, 还是qiushuiwuhen(秋水无痕) 的方法快!!!
      

  9.   

    谢了楼上两位,的确是qiushuiwuhen(秋水无痕)的方法快