Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Problem to open a asp-page in predefinedwindow


Message #1 by "Christofer Elgh" <chel@i...> on Fri, 16 Feb 2001 14:21:00
Christofer,

For Question 1:

Add the following javascript code to your HTML file.

<SCRIPT language=javascript>
function mySubmit()
{
 var height = 200 ;
 var width = 200 ;
 var sFeatures = "height=" + height + ",width="+ width +
",status=0,toolbar=0,menubar=0,location=0, resizable=1,scrollbars=0" ;
 window.open("", "ResultWindow", sFeatures);
 document.form_customeraddress.submit() ;
}
</SCRIPT>

Then set the "target" attribute of your form to "ResultWindow".  e.g. <FORM
target="ResultWindow" ...

Finally, modify your "GO" button by modifying the type and adding an onclick
: type=button onclick="mySubmit()"

That should do the trick.


For Question 2:

You can use the Response.ContentType to tell the browser what type of data
your are sending.
For example

Response.ContentType= "text/tab-separated-values"  'Browser is expecting an
TSV (and usually open Excel)

Response.ContentType = "application/octet-stream"  'Browser is expecting a
Binary file (prompt to save).

However, the browsers also base their actions on the file extension. So if
the browser does not have an application associated with the extension it
will prompt to save the file. (Also, for security reasons the browser should
prompt to save the file if you have not explicity said you want the browser
to automatically open that type of file.)

In short, you should be able to setup an automatic open for your computer
(or anybody that wants to setup the feature), but not for automatically for
someone who is just visiting your site.

Cheers,
Anil

Sevina Technologies.
www.Sevina.com



----- Original Message -----
From: "Christofer Elgh" <chel@i...>
To: "javascript" <javascript@p...>
Sent: Friday, February 16, 2001 2:21 PM
Subject: [javascript] Problem to open a asp-page in predefinedwindow


> Hi all
> Couldīnt find any answer in the book "Professional JavaScript".
> Actually i have two problems.
>
> 1)I have som problem with opening the result from a asp-page in a
> predefined window (IE5.0). I wish to open the result (answer) in a
> predefined window with for example: scrollbars=no, titlebar=no, widht=200,
> height=200 etc. What to do??
> My htm-page on the clientside look like this:
> <HTML>
> <HEAD>
> <META name="VI60_DefaultClientScript" content=JavaScript>
> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
> <LINK rel="stylesheet" type="text/css" href="stylesheet_top.css">
> <TITLE>Kundadress</TITLE>
> </HEAD>
> <BODY>
> <FORM name=customeraddress method=post
> action=http://servername/webparts/customeraddress.asp target=_blank
> id=form_customeraddress>
> <TABLE style="WIDTH: 1%" cellSpacing=1 cellPadding=2 width="1%"
> background="" border=0>
>   <TR>
>     <TD noWrap><H5>Write Customernr</H5></TD>
>     <TD noWrap></TD></TR>
>    <TR>
>     <TD noWrap> <INPUT id=txtCnrinv style="FONT-SIZE: x-small; LEFT:
> 2px; WIDTH: 54px; TOP: 3px; HEIGHT: 22px"
>       tabIndex=1 maxLength=5 CHECKED value=* name=txtCnrinv>
>     -<INPUT id=txtCnrship
>       style="FONT-SIZE: x-small; WIDTH: 38px; HEIGHT: 22px" tabIndex=2
>       maxLength=3 CHECKED name=txtCnrship>
>     </TD>
>     <TD noWrap><FONT size=3><STRONG><INPUT id=btnGo style="WIDTH: 50px;
> FONT-FAMILY: sans-serif; HEIGHT: 24px" tabIndex=3 type=submit size=50
> value=Go name=btnGo></STRONG></FONT></TD></TR></TABLE>
> </FORM>
> </BODY>
> </HTML>
>
>
> 2) How to open a Reflectionfile (*. r2W), wich starts a program called
> Reflection,  from a link in a browser WITHOUT getting any
downloadmessage??
>
>
> /Christofer
>


  Return to Index