How can I output text typed in textarea by user on the same page?

How can I output text typed in textarea by user on the same page?

I have a basic HTML page where I have created a textarea for users comments. I would like to take the comments and append them to the same page for all to see. Is this posibble and if so could you give me the code and instructions to do it?.

Kind regards.

Colin.

View Answers

July 23, 2011 at 11:13 AM

<html>
<head>
<script type="text/javascript">
function showComment(){ 
var data=document.getElementById("text").value;

     alert(data);
     document.getElementById("comment").style.visibility= "visible";
     document.getElementById("lab").innerHTML=data;
     }

</script>
</head>
<body>
Post Comment: <br><textarea id="text" rows="10" cols="40"></textarea><br>
<label id="comment" style="visibility:hidden"><b>Comments: </b></label><label id="lab"></label>
<br>
<input type="button" value="Post" onclick="showComment();">
</body>
</html>

July 24, 2011 at 1:06 AM

This is fantastic and thank you very much for the code. Could I impose a little more and just ask if it is possible that this code could be extended to!.

include other comments entered rather than over writing the first comment made. E.g:

This user type a positive comment.

This user wrote a negative comment.

This user wrote about the others comment.

Etc.

Many thanks.

Colin.









Related Tutorials/Questions & Answers:
How can I output text typed in textarea by user on the same page?
How to capture output from console into textarea in java?
Advertisements
how can i get output pls urget tell me
how can I great two user and password in C++?
how can I great two user and password in C++?
how can i store text box values as it is in database table
how can i use one dbase conection in serveral pages - JSP-Servlet
how can i send a mail to a particular user from a many user dropdown list in jsp
Posting comments to same page with textarea
I want to change my user name on your website ,how can i do this
Can I learn Python and R at the same time?
Can I learn Python same day?
How can I Convert my Image Files to Text Files? - IDE Questions
How can I dynamically load user-entered data as content of jquery dialog?
User Registration Form Using JSP(JspBeans) after that how i can insert in database
Can i insert image into struts text field
login for different user in the same page
Can I have multiple main() methods in the same class?
How to retrieve kernal memory details(paged and non-paged ) using SIGAR API in java program
how can i display a editable result of form?
How to get the text from textarea in HTML and store it in database using javascript and jsp
i want to type the intput in the output console box how?
TextArea Frame in Java
how to make authentication for each user using jsp/servlet?
Servlet signup same output - JSP-Servlet
how should i can solve
how to restrict user against marking same event more than one times - JSP-Servlet
How to ensure the same output by java code on 32 bit m/c and 64 bit m/c
I/O Program output error
How can I protect my database password ?
How can I do it? .click();
save output in multiple text files
How can I learn Java?
How can I change UIButton title color?
how can i create a discussion forum?
how can i print the selected content of a frame
ModuleNotFoundError: No module named 'pager'
How can I show users privileges in MySQL?
different output trying to execute same java code
How I can filling pdf file that crated by livecycle using itext
How many ways we can give the output to a browser?
different output trying to execute same java code
different output trying to execute same java code
Show image and text on same jsp page
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p
ModuleNotFoundError: No module named 'lazy-paged-sequence'
ModuleNotFoundError: No module named 'lazy-paged-sequence'
ModuleNotFoundError: No module named 'ldap_paged_search'
ModuleNotFoundError: No module named 'ldap_paged_search'

Ads