Putting value into textarea box instead of alert box


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>
LVL 16
hankknightAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

devicCommented:
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
pratikroyCommented:
Have a look at some samples at http://www.javascriptmall.com/learn/lesson6.htm
0
GwynforWebCommented:
<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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
devicCommented:
Gwyn, nice idea ;)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.