How To Pass Value To Pop Up Window Using Javascript Function?
I want to open new window from existing form.When I am clicking on new window in form then new form should open with results of value entered,but new window form is opening with ma
Solution 1:
Suppose your text field's id is myTextField
, whatever you named it. if it has no id, set a id for it. then, in the popup window, you can use JavaScript parent.document.getElementById('myTextField').value
to get the value of the textfield.
Solution 2:
Assign window.open()
to a variable so you can access it's elements.
<form>
<input type="textbox" id="txt" />
<input type="button" id="btn" value="Open window" />
</form>
<script>
document.getElementById('btn').onclick = function(){
var myWindow = window.open();
myWindow.document.body.innerHTML = document.getElementById('txt').value;
};
</script>
Post a Comment for "How To Pass Value To Pop Up Window Using Javascript Function?"