Hi there everyone,
So I want to start off by saying that I am not the greatest in Javascript, ahah. I am starting off with some of the basics and so forth, but came on to a problem that I seem to need help with.
I am trying to get a function to write to a textarea. Below is what I am trying to get at:
User Inputs Number > Presses Button > Writes to text area
Inputs in input box > Button onclick to function > function takes number and puts it to textarea
My code so far is below, but I am having troubles. I can get everything to show up in alert or document.write, but I have failed many times at getting it to write to a textarea.
Please do not give me the entire code. I just need a simple few lines showing how to get my function to write to text area..Thats it. So without further bickering, heres what I have so far:
I modified the code slightly, so if there are extra text boxes and stuff dont worry about that. Its simply the write to text area I need.Code:<html> <head> <script type="text/javascript"> function calculate() { var x = document.getElementById("one").value; alert(x); } </script> </head> <body> <center> <label>Numbers</label> </br> <input type="text" id="one" value="" size="1"/> </br> <button onclick="calculate()" >Caculate</button> </br> <label>Your Numbers</label> </br> <input type="text" id="two" value="" size="1"/> </br> <input type="text" id="" value="" size="1"/> </br> <textarea id="txt" readonly></textarea> </center> </body> </html>
I do thank anyone who can clarify the situation for me!


Reply With Quote
Bookmarks