trying to figure out how to put the the input from the prompt into a t

1 Replies - 6887 Views - Last Post: 25 February 2009 - 04:19 PM

using prompt and textarea

Posted 25 February 2009 - 02:07 PM

I know I have alot to add to this(/head, /body, etc) but am messing around with this assignment right now and can't figure something out. I am suppose to be able to hit the prompt button and the input from the user in prompt window is suppose to print out in the textarea in the bottom... have looked on the internet for a few hours and can't figure out how to do it =( The teacher set most of the code up for us (have done part of the assignment on it already) but am stuck on this part. any help is much appreciated

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript">
function show_prompt() {
var my_string = prompt("Please enter your name","enter your first name only");
}
</script>
<button id="alert" name="" value="Hello World" type="button" onclick="alert( document.getElementById('alert').value );">
Alert Button
</button>
<button id="fakebutton" type="button" onclick="show_prompt()">
Prompt Button
</button>
<button name="tb" type="button">
Toggle Button
</button>
<button name="b" type="button">
Bigger
</button>
<button name="s" type="button">
Smaller
</button>
<button name="c" type="button">
Cycle
</button>
<button name="r" type="button">
Read
</button>
<p id="green">
Forms do not have to send anything, you can use a form simply to place form boxes. This way the validators shut up and you can more easily refer to them in javascript. The
<b>
document
</b>
object contains an array of
<b>
form
</b>
objects, you can either get them by number document.forms[0] or, you can get them by the form's name (name attribute of the form tag) document.formname. In the form object, there is another array called
<b>
elements
</b>
which contains all form-related html tags within that form (form.elements[]). Just like with form, you can also use the name used in the attribute to refer to elements. (form.inputname)
<b>
NOTE:
</b>
the name attributes are case-sensitive
</p>
<form action="java script:alert('hello');" method="get">
<p>
<textarea id="textOutput" name="textOutput" rows="4" cols="80">
</textarea>
</p>
</form>