By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 1,552 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

cannot use JavaScript open window functions to open a request page??

P: n/a
My problem is when the user click the submit button, it will launch another
new window for the request page. I want to confirm we cannot use JavaScript
open window functions to open a request page? The following page2.asp won't
output the value entered in page1.asp. However, if we do <form
action="page2.asp" method="get" target="_blank">, then it will open a new
window for the request page, instead of using the same window as page1.asp.
But I want to use JavaScript window.open() or window.showModalDialog(),
seems like impossible?? If we use regular button (<input type="button"...>),
then
we can use JavaScript open window, but this is not posting form. Right??
Please advise! Thanks!!

//page1.asp
<html>
<body>
<head>
<script type="text/javascript">
function openwindow()
{
var sReturn = window.showModalDialog("page2.asp", document,
"dialogHeight:700px; dialogWidth:500px;");
}
</script>
</head>
<body>
<form action="page2.asp" method="get">
<P>First Name: <input type="text" name="fname">
<P>Last Name: <input type="text" name="lname">
<P><input type="submit" value="validate" onclick="openwindow()">
</form>
</body>
</html>

//page2.asp
<html>
<body>
<P>first name from page1.asp = <%= Request.QueryString("fname") %>
<P>Last name from page1.asp = <%= Request.QueryString("lname") %>
</body>
</html>

Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

I've never tried this, but I think if you create your target window through
javascript before the post event of your form goes off, you'll be loading
the result of your post in this newly created window.

You set the target attribute to "_blank", but you can also specify a
windows name in there, eg. "mywindow". So if you use JavaScript to create a
window with the name "mywindow" before you post your form, the browser will
probably use that window to display the forms result.

"Matt" <ma*******@hotmail.com> wrote in message
news:us*************@TK2MSFTNGP10.phx.gbl...
My problem is when the user click the submit button, it will launch another new window for the request page. I want to confirm we cannot use JavaScript open window functions to open a request page? The following page2.asp won't output the value entered in page1.asp. However, if we do <form
action="page2.asp" method="get" target="_blank">, then it will open a new
window for the request page, instead of using the same window as page1.asp. But I want to use JavaScript window.open() or window.showModalDialog(),
seems like impossible?? If we use regular button (<input type="button"...>), then
we can use JavaScript open window, but this is not posting form. Right??
Please advise! Thanks!!

//page1.asp
<html>
<body>
<head>
<script type="text/javascript">
function openwindow()
{
var sReturn = window.showModalDialog("page2.asp", document,
"dialogHeight:700px; dialogWidth:500px;");
}
</script>
</head>
<body>
<form action="page2.asp" method="get">
<P>First Name: <input type="text" name="fname">
<P>Last Name: <input type="text" name="lname">
<P><input type="submit" value="validate" onclick="openwindow()">
</form>
</body>
</html>

//page2.asp
<html>
<body>
<P>first name from page1.asp = <%= Request.QueryString("fname") %>
<P>Last name from page1.asp = <%= Request.QueryString("lname") %>
</body>
</html>

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.