我感到困惑在第3行 區分變量和ID
userInput
的userInput
在管線8的
var userInput
之間的關係具體地,第4行中的userInput
(=
的右側)是否參見第3行中的var userInput
?還是指第8行的編號爲userInput
?此外,第3行中的變量
userInput
在分配給document.getelementbyID('userInput').value
之後如何使用?1 <script type = "text/javascript"> 2 function changeText2() { 3 var userInput = document.getElementById('userInput').value; 4 document.getElementById('boldStuff2').innerHTML = userInput; 5 } 6 </script> 7 <p>Welcome to the site <b id = 'boldStuff2'>dude</b></p> 8 <input type = 'text' id = 'userInput' value = 'Enter Text Here'/> 9 <input type = 'button' onclick = 'changeText2()' value = 'Change Text'/>
什麼教程? – Trufa 2011-02-14 03:47:06
哦,你去了! – Trufa 2011-02-14 03:47:52
請格式化您的代碼。 – 2011-02-14 03:47:58