|
|||||||
| JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...) |
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Window.open for POST method
Hello all,
How can I have a new pop up opening up using window.open() while using POST method in an HTML form. Here is a sample function I have tried. Here I want to show the result of the program in the new pop up whose size and other attributes can be controlled by me. Using "_new" is not accepatable. function doscratch_mail(){ fh = document.scratchpad; // fh.action= "/dgtlbin/scratch_mail"; window.open("/dgtlbin/scratch_mail","scratch_mail","toolbar=0,status=0,scrollbars=1,location=0,width=490,height=415,resiza ble=0"); //fh.target= "_new"; fh.method = "POST"; fh.submit(); return false; } Hoping to get a quick response, as I desperately need a solution to this. Regards, Ritu |
|
#2
|
||||
|
||||
|
It's easier to use the form tag instead of a function.
<FORM name=form onsubmit="javascript:window.open('','fenster','width=400,height=500,scrollbars=yes')" action="YourActionFile.html" method="post" target="fenster"> let me know if it's not what you want.
__________________
Swon |
|
#3
|
||||
|
||||
|
Quote:
<FORM name=form onsubmit="window.open('','fenster','width=400,height=500,scrollbars=yes')" action="YourActionFile.html" method="post" target="fenster">
__________________
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.” —Tim Berners-Lee, W3C Director and inventor of the World Wide Web |
|
#4
|
|||
|
|||
|
javascript solution:
function openWindowWithPost(url,name,keys,values) { var newWindow = window.open(url, name); if (!newWindow) return false; var html = ""; html += "<html><head></head><body><form id='formid' method='post' action='" + url + "'>"; if (keys && values && (keys.length == values.length)) for (var i=0; i < keys.length; i++) html += "<input type='hidden' name='" + keys[i] + "' value='" + values[i] + "'/>"; html += "</form><script type='text/javascript'>document.getElementById(\"formid\").submit()</script></body></html>"; newWindow.document.write(html); return newWindow; } works in IE and firefox |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|