Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Open New window and size it to size of graphic

Reply
Thread Tools

Open New window and size it to size of graphic

 
 
tshad
Guest
Posts: n/a
 
      02-08-2007
I have an aspx window that is going to open a window (javascript) and
display a graphic. I want to resize the window to the size of the graphic
before it actually displays - how do I do that?

In my calling routine I have the following:
***********************************
function OpenLogoPreviewWindow()
{
window.open('logoDisplay.htm','mywindow');
}
***********************************

The logoDislay.htm page is:
****************************
<script language="JavaScript">

function entry()
{
document.LogoDisplay.src = "..\\..\\uploads\\" +
opener.document.getElementById('Logo').innerHTML;
window.resizeTo(?,?);
}
</script>
</head>
<body onLoad="entry()">
<img name="LogoDisplay">
</body>
</html>
*************************************

The program works fine but the window the graphic displays in is way to big
and the each graphic is a different size so I need the window to only be the
size of the graphic.

Thanks,

Tom


 
Reply With Quote
 
 
 
 
Aidy
Guest
Posts: n/a
 
      02-08-2007
Assume the script is in the same folder as your image

string filename = "mypic.jpg";
Image img = new Bitmap(Server.MapPath(filename));
Size size = img.Size;
img.Dispose();

string scriptToWrite = "window.open ('" + filename + "', '_blank',
'menubar=no, status=no, toolbar=no, width=" + size.Width.ToString() + ",
height=" + size.Height.ToString() + "');"); }

"tshad" <> wrote in message
news:%...
>I have an aspx window that is going to open a window (javascript) and
>display a graphic. I want to resize the window to the size of the graphic
>before it actually displays - how do I do that?
>
> In my calling routine I have the following:
> ***********************************
> function OpenLogoPreviewWindow()
> {
> window.open('logoDisplay.htm','mywindow');
> }
> ***********************************
>
> The logoDislay.htm page is:
> ****************************
> <script language="JavaScript">
>
> function entry()
> {
> document.LogoDisplay.src = "..\\..\\uploads\\" +
> opener.document.getElementById('Logo').innerHTML;
> window.resizeTo(?,?);
> }
> </script>
> </head>
> <body onLoad="entry()">
> <img name="LogoDisplay">
> </body>
> </html>
> *************************************
>
> The program works fine but the window the graphic displays in is way to
> big and the each graphic is a different size so I need the window to only
> be the size of the graphic.
>
> Thanks,
>
> Tom
>



 
Reply With Quote
 
 
 
 
tshad
Guest
Posts: n/a
 
      02-08-2007
"Aidy" <> wrote in message
news:...
> Assume the script is in the same folder as your image
>
> string filename = "mypic.jpg";
> Image img = new Bitmap(Server.MapPath(filename));
> Size size = img.Size;
> img.Dispose();
>
> string scriptToWrite = "window.open ('" + filename + "', '_blank',
> 'menubar=no, status=no, toolbar=no, width=" + size.Width.ToString() + ",
> height=" + size.Height.ToString() + "');"); }


I got this working but the status bar shows anyway. Is there a way to get
the status bar to disappear?

Thanks,

Tom

>
> "tshad" <> wrote in message
> news:%...
>>I have an aspx window that is going to open a window (javascript) and
>>display a graphic. I want to resize the window to the size of the graphic
>>before it actually displays - how do I do that?
>>
>> In my calling routine I have the following:
>> ***********************************
>> function OpenLogoPreviewWindow()
>> {
>> window.open('logoDisplay.htm','mywindow');
>> }
>> ***********************************
>>
>> The logoDislay.htm page is:
>> ****************************
>> <script language="JavaScript">
>>
>> function entry()
>> {
>> document.LogoDisplay.src = "..\\..\\uploads\\" +
>> opener.document.getElementById('Logo').innerHTML;
>> window.resizeTo(?,?);
>> }
>> </script>
>> </head>
>> <body onLoad="entry()">
>> <img name="LogoDisplay">
>> </body>
>> </html>
>> *************************************
>>
>> The program works fine but the window the graphic displays in is way to
>> big and the each graphic is a different size so I need the window to only
>> be the size of the graphic.
>>
>> Thanks,
>>
>> Tom
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Window.Open get new tab instead of new window in FireFox Fredzidd@gmail.com Javascript 1 02-29-2008 03:06 AM
Is it possible to mouseover a GRAPHIC . . . that launches another (freestanding) GRAPHIC (ie. when flash is _not_ available)? 50 SOMETHING GAL HTML 3 12-10-2006 01:10 AM
HELP: need to customize the size of the window.open window for different links jdapro Javascript 1 03-22-2005 02:53 PM
window.open() doesn't open new Window in Opera PC HUA Javascript 2 05-19-2004 02:29 AM
Need to open a new browser window, not a new window Gordon ASP General 3 04-16-2004 10:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57