Share on Google+Share on Google+

Colin Lansdown
How can I output text typed in textarea by user on the same page?
2 Answer(s)      5 years and 9 months ago
Posted in : HTML

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.

Ads

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:
Advertisements
Tutorials   
Java Spring Hibernate Struts Training How to display button as a link in vaadin? hi change navbar dropdown color in bootstrap How to remove the background color of bootstrap menu bar? How to change color of opened Bootstrap drop down toggle? Setting bootstrap container background color Help school all activities and admision process.. add one row after another date make a webpage HTMl HTMl Source code how to apply globalisation to a world wide asp.net application how to print HTML using javascript or Jquery How to recover from google panda update? How to survive google panda 4.0 update How to find if you have been hit by Panda 4.0 Design a web page using XHTML and JavaScript that does the followings: ffmpeg converting file mp4 to mov JavaScript How to Disable Catch-all Emails on CPanel z-index always on top What is Web hosting Database and HTML web development trainee Uploading files Image Gallery Image Gallery dropdown How to redirect from a HTML page? Easiest method for expiring the css and js headers HTML WITH AJAX VB 6 Read Web Page Header string palindrom using vbscript? html button How to add mod_deflate to apache without recompiling How to use place hoder in IE(version : 8) Html Software Question div align left css Fetching data from excel file on other website and display in interactive graph form where do I find the fix for tree view catalog not expanding and collapsing correctly for roseindia shopping cart 1.1 pass to next page to enter into a particular page only if the username,password and listbox value mtches hi Cricket stadium ticket booking design Need some help creating an order form. HTML div tag HTML div tag

Ads

 
Advertisement null

Ads