2011-04-16 63 views
3

好吧,这是我迄今为止的小麦。如果有人能帮助我。当你点击一个按钮时,我不得不改变背景的颜色。我还必须使用document.getElementById('yourelementid')来查找textarea的值并更改在div中创建的基本文本。但我不知道该怎么做,我一直在网上进行研究。我想我在这里感谢有点困惑在哪里把事情放在这里。如何更改文本框中的文本

这里是我到目前为止....

 <!DOCTYPE html PUBLIC "-//W3C//DTD Xhtml 1.0 Strict//EN" 
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    <html xmlns="http:www.w3.org/1999/xhtml"> 
    <head> 
    <title>DOM</title> 
    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" /> 

    <script language="JavaScript"> 
    <!-- Begin 
     function newbg(thecolor) 
     { 
    document.bgColor=thecolor; 
     } 

    // End --> 
    </script> 
     <body> 
    <h3>DOM Assignment Examples</h3> 
    <div> 
    <form> 
     <h4>Change background color to:</h4> 
    <input type="radio" value="White" onclick="newbg('white');">white<br/> 
    <input type="radio" value="Blue" onclick="newbg('blue');">Blue<br /> 
    <input type="radio" value="Beige" onclick="newbg('Beige');">Beige<br /> 
    <input type="radio" value="Yellow" onclick="newbg('yellow');">Yellow<br /> 
    </form> 
    </div> 
    <br /> 
    <br /> 
    <br /> 
    <h4>add text to this box change the text below:</h4> 
    <TEXTAREA NAME="" ROWS="10" COLS="40" onBlur="blurHandlerRouting"> 
    You will change this text 
    </TEXTAREA> <br /> 
    <INPUT TYPE="button" NAME="button" Value="Click" onClick="testResults(this.form)"> 
    </body> 


    </html> 
+1

我不明白......当在用户点击按钮,会发生什么? “