我把JS获取的值 传送到文本框内<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>获取值</title>
<script>
function go(){
var myHerf=top.location.href;
var title=document.title;
document.getElementById("show").innerHTML= myHerf;
}
go();
</script>
</head><body>
<form action="lottery.php" method="post" target="_blank">
<textarea name="message" cols="100" rows="20" id="show">
</textarea>
</form></body>
</html>

解决方案 »

  1.   


    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>获取值</title>
    <script>
    function go(){
    var myHerf=top.location.href;
    var title=document.title;
    document.getElementById("show").value= myHerf;
    }
    onload = go;
    </script>
    </head><body>
    <form action="lottery.php" method="post" target="_blank">
    <textarea name="message" cols="100" rows="20" id="show">
    </textarea>
    </form></body>
    </html>
      

  2.   

    document.getElementById("show").innerHTML= myHerf;textarea 没有 innerHTML 属性,用 value 代替 innerHTML