We help IT Professionals succeed at work.
Get Started

Passing a value from a textbox to a child pop-up window

Overthere asked
Last Modified: 2015-07-08
Hi folks,

  I have a page written in php ,

Open in new window

html and some javascript. It works well. I have a preview button in which I want to take the value from a textbox and display it in a child window. My script for popping up the child window works well, I just can't seem to get the value of the textbox passed to the child window.  I have posted the javascript, the html for the textbox and coding from my child window. The value that I am passing is html code. Any help appreciated....

This the textbox control - is placed between form tags.

 <table  align="center">
            <tr><td><textarea id="myhtml" name="supoffers" cols="80" rows="20"></textarea></td></tr>

Open in new window


This is the javascript that calls the function to open a pop-up child window
<script type="text/javascript" language="javascript">
    var passVariable;
    function mkPreview() 
	    var passVariable= document.getElementById("myhtml").value;
	    window.open('preview.html', 'Preview', 'width=600, height=600,left=70, top=70 scrollbars=yes resizable=yes menubar=no');


Open in new window

This is the code in the child window - its the only code there


Open in new window

Watch Question
Expert of the Year 2008
Top Expert 2008
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE