Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Putting value into textarea box instead of alert box

Posted on 2004-11-01
4
Medium Priority
?
280 Views
Last Modified: 2008-03-06

Hello.

The following puts "pagecontent" in an alert box.

I want a new window (or dialog box) to open up with a textarea box, containing the content of "pagecontent"

How can this be done?

Thanks!        



         <form name="mainbox" onsubmit="return submitForm();">
         <script language="JavaScript" type="text/javascript">
         <!--

         var pagecontent = "the text that I want in a textarea box goes here";

         function submitForm() {
               alert (pagecontent);
               return false;
         }

         //-->
         </script>

         <input type=submit>
         </form>
0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 25

Expert Comment

by:devic
ID: 12464181
hi hankknight,
something like this:
=================

  <form name="mainbox" onsubmit="return submitForm();">
        <script language="JavaScript" type="text/javascript">
        <!--

        var pagecontent = "the text that I want in a textarea box goes here";

        function submitForm()
            {
             var myWin=window.open("about:blank","","width=300,height=300");
                   myWin.document.write("<html><body bgcolor=ffffff topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>");
                   myWin.document.write("<form><textarea style=width:300px;height:300px;>"+pagecontent+"</textarea></form>");
                   myWin.document.write("</body></html>");
                   myWin.document.close();
             return false;
        }

        //-->
        </script>

        <input type=submit>
        </form>
0
 
LVL 9

Expert Comment

by:pratikroy
ID: 12464200
Have a look at some samples at http://www.javascriptmall.com/learn/lesson6.htm
0
 
LVL 31

Accepted Solution

by:
GwynforWeb earned 2000 total points
ID: 12464219
<script language="JavaScript" type="text/javascript">
         <!--

         var pagecontent = "the text that I want in a textarea box goes here";

         function submitForm() {
           win=window.open('','','height=200,width=300')
           str='<textarea cols=25 rows=7>'+pagecontent+'</textarea>'
           win.document.write(str)
           return false;
         }

         //-->
</script>


<form name="mainbox" onsubmit="return submitForm();">
  <p><input type="submit"> </p>
</form>
0
 
LVL 25

Expert Comment

by:devic
ID: 12464557
Gwyn, nice idea ;)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question