私はJavascriptを初めて使用し、問題を抱えています。ユーザーに単語を入力してもらい、その単語を識別して同じページのユーザーに印刷する機能を持たせたい。このコードを実行するたびに、別のページに移動して「[object]」を出力します。これが私のコードです。誰か助けてくれませんか。
長く生きると繁栄。
<html>
<head>
<script src="raphael-min.js"></script>
<script src="jquery-1.7.2.js"></script>
<script type="text/javascript">
function animate() {
var txt = document.getElementById("words");
document.write(txt);
}
</script>
</head>
<body>
Text: <input type="text" id="words" value="" />
<input type="submit" value="Animate" onclick="animate()" />
</body>
</html>