PC Review


Reply
Thread Tools Rate Thread

Controlling browser window size

 
 
=?Utf-8?B?TWFyY1Bhcm5lcw==?=
Guest
Posts: n/a
 
      20th Feb 2006
Hi,
I have a thumbnail that opens a smallish picture in a new browser window.
I'd like to control the size of the new window so its about the same size as
the picture. Now it opens up a fullscreen window which dwarfs the picture.
I've seen other sites that do that but I can't figure out how to do it in FP.
Can someone help please?

Thanks,
Marc
 
Reply With Quote
 
 
 
 
Trevor L.
Guest
Posts: n/a
 
      20th Feb 2006
MarcParnes wrote:
> Hi,
> I have a thumbnail that opens a smallish picture in a new browser
> window. I'd like to control the size of the new window so its about
> the same size as the picture. Now it opens up a fullscreen window
> which dwarfs the picture. I've seen other sites that do that but I
> can't figure out how to do it in FP. Can someone help please?
>
> Thanks,
> Marc


Marc,
FP won't do it by itself, but Steve Easton (MVP) and I have been having a
discussion over many threads about a script that will do it.

Steve's script is below, with one small change (only he will know what it
is).
Go to Code or HTML view and paste it between <head> and </head>:
// =============== Script to paste ================
<script type="text/javascript">
var img , imageToLoad , sVarA , sVarRS
var newwindow , newdocument , sToPass
function newWindow(img)
{
imageToLoad = new Image()
new function testit()
{
imageToLoad.src = (img)
// we need a little pause while the script gets the image since the
image is on the server,
// or the browser will open the window and write the script before the
image is cached,
// which causes the script to write zeros for the resizeto dimensions.
setTimeout(loadit,1000)
//--- Internal function ---
function loadit()
{
sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width +
",height=" + imageToLoad.height)
sVarRS = 'onload="resizeTo(' + imageToLoad.width + ',' +
imageToLoad.height + ')"'

sToPass='<html><head>\n'
+ '<style type="text/css"> body{ background-repeat:
no-repeat; }</style>\n'
+ '<title>' + img + '</title>\n'
+ '</head>\n'
+ '<body ' + sVarRS + ' background=' + img + '>\n'
+ '</body></html>'
//check to see if we have the dimensions and if not, go back and wait
another 1 second
if ( imageToLoad.width == 0 ){ testit() }
else
newwindow = window.open('','',sVarA)
newdocument = newwindow.document
newdocument.write(sToPass)
newdocument.close()
}
//--- End loadit() ---
}
//--- End testit() ---
}
</script>
// =============== End of Script ================

Call it from HTML by
<a href="#" onclick="newWindow('mypicture.jpg')">
<img src="mypicture_t.jpg" alt=" ">My picture</a>
Change:
'mypicture.jpg' to the name of your image
"mypicture_t.jpg" to the name of your thumbnail image
'My picture' to your caption

You can change the position of the page by left and top in this line
sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width +
",height=" + imageToLoad.height)

I found it works quite nicely.

Steve, hope you don't mind. I think the script is great.
I have modified it myself (see my website) to place the background image in
a grey box, centered horizontally, with grey rounded corners, but that's
just an added bell (or is a whistle?) Marc, I can send details of how to do
this, but the rounded corners are a bit tricky.

--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


 
Reply With Quote
 
=?Utf-8?B?TWFyY1Bhcm5lcw==?=
Guest
Posts: n/a
 
      20th Feb 2006
Thank you Trevor! I'm going to give it a try.

Marc

"Trevor L." wrote:

> MarcParnes wrote:
> > Hi,
> > I have a thumbnail that opens a smallish picture in a new browser
> > window. I'd like to control the size of the new window so its about
> > the same size as the picture. Now it opens up a fullscreen window
> > which dwarfs the picture. I've seen other sites that do that but I
> > can't figure out how to do it in FP. Can someone help please?
> >
> > Thanks,
> > Marc

>
> Marc,
> FP won't do it by itself, but Steve Easton (MVP) and I have been having a
> discussion over many threads about a script that will do it.
>
> Steve's script is below, with one small change (only he will know what it
> is).
> Go to Code or HTML view and paste it between <head> and </head>:
> // =============== Script to paste ================
> <script type="text/javascript">
> var img , imageToLoad , sVarA , sVarRS
> var newwindow , newdocument , sToPass
> function newWindow(img)
> {
> imageToLoad = new Image()
> new function testit()
> {
> imageToLoad.src = (img)
> // we need a little pause while the script gets the image since the
> image is on the server,
> // or the browser will open the window and write the script before the
> image is cached,
> // which causes the script to write zeros for the resizeto dimensions.
> setTimeout(loadit,1000)
> //--- Internal function ---
> function loadit()
> {
> sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width +
> ",height=" + imageToLoad.height)
> sVarRS = 'onload="resizeTo(' + imageToLoad.width + ',' +
> imageToLoad.height + ')"'
>
> sToPass='<html><head>\n'
> + '<style type="text/css"> body{ background-repeat:
> no-repeat; }</style>\n'
> + '<title>' + img + '</title>\n'
> + '</head>\n'
> + '<body ' + sVarRS + ' background=' + img + '>\n'
> + '</body></html>'
> //check to see if we have the dimensions and if not, go back and wait
> another 1 second
> if ( imageToLoad.width == 0 ){ testit() }
> else
> newwindow = window.open('','',sVarA)
> newdocument = newwindow.document
> newdocument.write(sToPass)
> newdocument.close()
> }
> //--- End loadit() ---
> }
> //--- End testit() ---
> }
> </script>
> // =============== End of Script ================
>
> Call it from HTML by
> <a href="#" onclick="newWindow('mypicture.jpg')">
> <img src="mypicture_t.jpg" alt=" ">My picture</a>
> Change:
> 'mypicture.jpg' to the name of your image
> "mypicture_t.jpg" to the name of your thumbnail image
> 'My picture' to your caption
>
> You can change the position of the page by left and top in this line
> sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width +
> ",height=" + imageToLoad.height)
>
> I found it works quite nicely.
>
> Steve, hope you don't mind. I think the script is great.
> I have modified it myself (see my website) to place the background image in
> a grey box, centered horizontally, with grey rounded corners, but that's
> just an added bell (or is a whistle?) Marc, I can send details of how to do
> this, but the rounded corners are a bit tricky.
>
> --
> Cheers,
> Trevor L.
> Website: http://tandcl.homemail.com.au
>
>
>

 
Reply With Quote
 
Murray
Guest
Posts: n/a
 
      20th Feb 2006
Trevor - have you or Steve tried this on Macs?

--
Murray
--------------
MVP FrontPage


"Trevor L." <Trevor L.@Canberra> wrote in message
news:(E-Mail Removed)...
> MarcParnes wrote:
>> Hi,
>> I have a thumbnail that opens a smallish picture in a new browser
>> window. I'd like to control the size of the new window so its about
>> the same size as the picture. Now it opens up a fullscreen window
>> which dwarfs the picture. I've seen other sites that do that but I
>> can't figure out how to do it in FP. Can someone help please?
>>
>> Thanks,
>> Marc

>
> Marc,
> FP won't do it by itself, but Steve Easton (MVP) and I have been having a
> discussion over many threads about a script that will do it.
>
> Steve's script is below, with one small change (only he will know what it
> is).
> Go to Code or HTML view and paste it between <head> and </head>:
> // =============== Script to paste ================
> <script type="text/javascript">
> var img , imageToLoad , sVarA , sVarRS
> var newwindow , newdocument , sToPass
> function newWindow(img)
> {
> imageToLoad = new Image()
> new function testit()
> {
> imageToLoad.src = (img)
> // we need a little pause while the script gets the image since the
> image is on the server,
> // or the browser will open the window and write the script before the
> image is cached,
> // which causes the script to write zeros for the resizeto dimensions.
> setTimeout(loadit,1000)
> //--- Internal function ---
> function loadit()
> {
> sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width +
> ",height=" + imageToLoad.height)
> sVarRS = 'onload="resizeTo(' + imageToLoad.width + ',' +
> imageToLoad.height + ')"'
>
> sToPass='<html><head>\n'
> + '<style type="text/css"> body{ background-repeat:
> no-repeat; }</style>\n'
> + '<title>' + img + '</title>\n'
> + '</head>\n'
> + '<body ' + sVarRS + ' background=' + img + '>\n'
> + '</body></html>'
> //check to see if we have the dimensions and if not, go back and wait
> another 1 second
> if ( imageToLoad.width == 0 ){ testit() }
> else
> newwindow = window.open('','',sVarA)
> newdocument = newwindow.document
> newdocument.write(sToPass)
> newdocument.close()
> }
> //--- End loadit() ---
> }
> //--- End testit() ---
> }
> </script>
> // =============== End of Script ================
>
> Call it from HTML by
> <a href="#" onclick="newWindow('mypicture.jpg')">
> <img src="mypicture_t.jpg" alt=" ">My picture</a>
> Change:
> 'mypicture.jpg' to the name of your image
> "mypicture_t.jpg" to the name of your thumbnail image
> 'My picture' to your caption
>
> You can change the position of the page by left and top in this line
> sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width +
> ",height=" + imageToLoad.height)
>
> I found it works quite nicely.
>
> Steve, hope you don't mind. I think the script is great.
> I have modified it myself (see my website) to place the background image
> in a grey box, centered horizontally, with grey rounded corners, but
> that's just an added bell (or is a whistle?) Marc, I can send details of
> how to do this, but the rounded corners are a bit tricky.
>
> --
> Cheers,
> Trevor L.
> Website: http://tandcl.homemail.com.au
>



 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      21st Feb 2006
Murray wrote:
> Trevor - have you or Steve tried this on Macs?


Don't know about Steve.
He says it is still in development. He calls it tinkering.

I am at a similar stage. I feel that sometimes it doesn't work.

I did notice that Firefox had a message in the Javascript Console:
"Too many recursions" which may be realated

When it doesn't work, I replace
if ( imageToLoad.width == 0 ){ testit() }
by
if ( imageToLoad.width == 0 )
alert('Image did not load. Please try again')
This does not seem to fail. When I do try again, the image loads fine.

I am thinking a better option may be
if ( imageToLoad.width == 0 )
{
alert('Image did not load. Press enter to try again')
testit()
}

To answer the specific question:
No. I do not have access to a Mac

--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


 
Reply With Quote
 
Steve Easton
Guest
Posts: n/a
 
      21st Feb 2006
Hi Murray,
As Trevor mentioned this is just something I've been playing with because I
think it's possible to point a script at a folder full of images and create
the links "on the fly."

That said. I've not tried it on a Mac. But, if a Mac supports JavaScript
that's been around since the days of Mosaic, it "should work."


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer



"Murray" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Trevor - have you or Steve tried this on Macs?
>
> --
> Murray
> --------------
> MVP FrontPage
>
>
> "Trevor L." <Trevor L.@Canberra> wrote in message
> news:(E-Mail Removed)...
>> MarcParnes wrote:
>>> Hi,
>>> I have a thumbnail that opens a smallish picture in a new browser
>>> window. I'd like to control the size of the new window so its about
>>> the same size as the picture. Now it opens up a fullscreen window
>>> which dwarfs the picture. I've seen other sites that do that but I
>>> can't figure out how to do it in FP. Can someone help please?
>>>
>>> Thanks,
>>> Marc

>>
>> Marc,
>> FP won't do it by itself, but Steve Easton (MVP) and I have been having
>> a discussion over many threads about a script that will do it.
>>
>> Steve's script is below, with one small change (only he will know what it
>> is).
>> Go to Code or HTML view and paste it between <head> and </head>:
>> // =============== Script to paste ================
>> <script type="text/javascript">
>> var img , imageToLoad , sVarA , sVarRS
>> var newwindow , newdocument , sToPass
>> function newWindow(img)
>> {
>> imageToLoad = new Image()
>> new function testit()
>> {
>> imageToLoad.src = (img)
>> // we need a little pause while the script gets the image since the
>> image is on the server,
>> // or the browser will open the window and write the script before the
>> image is cached,
>> // which causes the script to write zeros for the resizeto dimensions.
>> setTimeout(loadit,1000)
>> //--- Internal function ---
>> function loadit()
>> {
>> sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width +
>> ",height=" + imageToLoad.height)
>> sVarRS = 'onload="resizeTo(' + imageToLoad.width + ',' +
>> imageToLoad.height + ')"'
>>
>> sToPass='<html><head>\n'
>> + '<style type="text/css"> body{ background-repeat:
>> no-repeat; }</style>\n'
>> + '<title>' + img + '</title>\n'
>> + '</head>\n'
>> + '<body ' + sVarRS + ' background=' + img + '>\n'
>> + '</body></html>'
>> //check to see if we have the dimensions and if not, go back and
>> wait another 1 second
>> if ( imageToLoad.width == 0 ){ testit() }
>> else
>> newwindow = window.open('','',sVarA)
>> newdocument = newwindow.document
>> newdocument.write(sToPass)
>> newdocument.close()
>> }
>> //--- End loadit() ---
>> }
>> //--- End testit() ---
>> }
>> </script>
>> // =============== End of Script ================
>>
>> Call it from HTML by
>> <a href="#" onclick="newWindow('mypicture.jpg')">
>> <img src="mypicture_t.jpg" alt=" ">My picture</a>
>> Change:
>> 'mypicture.jpg' to the name of your image
>> "mypicture_t.jpg" to the name of your thumbnail image
>> 'My picture' to your caption
>>
>> You can change the position of the page by left and top in this line
>> sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width +
>> ",height=" + imageToLoad.height)
>>
>> I found it works quite nicely.
>>
>> Steve, hope you don't mind. I think the script is great.
>> I have modified it myself (see my website) to place the background image
>> in a grey box, centered horizontally, with grey rounded corners, but
>> that's just an added bell (or is a whistle?) Marc, I can send details of
>> how to do this, but the rounded corners are a bit tricky.
>>
>> --
>> Cheers,
>> Trevor L.
>> Website: http://tandcl.homemail.com.au
>>

>
>



 
Reply With Quote
 
Trevor L.
Guest
Posts: n/a
 
      21st Feb 2006
Steve Easton wrote:
> Hi Murray,
> As Trevor mentioned this is just something I've been playing with
> because I think it's possible to point a script at a folder full of
> images and create the links "on the fly."


Steve,
As you know I have been playing with this as well.

Below is my latest version.

OK, so I call spawnJimco Popup to open the window instead of the basic
window open calls. But this is to give me some extra stuff - a centred
window with a Print button, a "Click to close" option, and a grey background
with rounded corners. However, the principle is the same.

This seems to work every time in IE6 and FF1.5 on my local web. I do not
even get the confirm box coming up. I will put it on my website and test it
here.

I will keep an eye out in the NG to see if you find any other problems with
it in your testing.

// ========= Latest Version==============
function newWindow(img,caption)
{
var imageToLoad = new Image()
new function testit()
{
imageToLoad.src = img
// we need a little pause while the script gets the image
setTimeout(loadit,1000)

//--- Internal function ---
function loadit()
{
// check to see if we have the dimensions and if not, go back and wait
another 1 second
var w = imageToLoad.width
if (w == 0 )
{
if (confirm('Image did not load.\nPress OK to try again\nPress
Cancel to exit')==true)
testit()
else
return
}
else
{
var h = imageToLoad.height
var windh = h + 50
spawnJimcoPopup
('picture.html?picture=' + img + '&amp;caption=' + caption
+ '&amp;height=' + h + '&amp;width=' + w
, '_blank'
,
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'
, windh,w,'center','0','pixel')
}
} //--- End loadit() ---
} //--- End testit() ---
}
// ========= End Latest Version==============

--
Cheers,
Trevor L.
Website: http://tandcl.homemail.com.au


 
Reply With Quote
 
Murray
Guest
Posts: n/a
 
      21st Feb 2006
It does - what I'm more concerned about is having the Mac dynamically resize
the page based on the image's size. That has been problematic in the past -
something about how the Mac manages images or something....

--
Murray
--------------
MVP FrontPage


"Steve Easton" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi Murray,
> As Trevor mentioned this is just something I've been playing with because
> I think it's possible to point a script at a folder full of images and
> create the links "on the fly."
>
> That said. I've not tried it on a Mac. But, if a Mac supports JavaScript
> that's been around since the days of Mosaic, it "should work."
>
>
> --
> Steve Easton
> Microsoft MVP FrontPage
> 95isalive
> This site is best viewed............
> .......................with a computer
>
>
>
> "Murray" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Trevor - have you or Steve tried this on Macs?
>>
>> --
>> Murray
>> --------------
>> MVP FrontPage
>>
>>
>> "Trevor L." <Trevor L.@Canberra> wrote in message
>> news:(E-Mail Removed)...
>>> MarcParnes wrote:
>>>> Hi,
>>>> I have a thumbnail that opens a smallish picture in a new browser
>>>> window. I'd like to control the size of the new window so its about
>>>> the same size as the picture. Now it opens up a fullscreen window
>>>> which dwarfs the picture. I've seen other sites that do that but I
>>>> can't figure out how to do it in FP. Can someone help please?
>>>>
>>>> Thanks,
>>>> Marc
>>>
>>> Marc,
>>> FP won't do it by itself, but Steve Easton (MVP) and I have been having
>>> a discussion over many threads about a script that will do it.
>>>
>>> Steve's script is below, with one small change (only he will know what
>>> it is).
>>> Go to Code or HTML view and paste it between <head> and </head>:
>>> // =============== Script to paste ================
>>> <script type="text/javascript">
>>> var img , imageToLoad , sVarA , sVarRS
>>> var newwindow , newdocument , sToPass
>>> function newWindow(img)
>>> {
>>> imageToLoad = new Image()
>>> new function testit()
>>> {
>>> imageToLoad.src = (img)
>>> // we need a little pause while the script gets the image since the
>>> image is on the server,
>>> // or the browser will open the window and write the script before
>>> the image is cached,
>>> // which causes the script to write zeros for the resizeto
>>> dimensions.
>>> setTimeout(loadit,1000)
>>> //--- Internal function ---
>>> function loadit()
>>> {
>>> sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width
>>> + ",height=" + imageToLoad.height)
>>> sVarRS = 'onload="resizeTo(' + imageToLoad.width + ',' +
>>> imageToLoad.height + ')"'
>>>
>>> sToPass='<html><head>\n'
>>> + '<style type="text/css"> body{ background-repeat:
>>> no-repeat; }</style>\n'
>>> + '<title>' + img + '</title>\n'
>>> + '</head>\n'
>>> + '<body ' + sVarRS + ' background=' + img + '>\n'
>>> + '</body></html>'
>>> //check to see if we have the dimensions and if not, go back and
>>> wait another 1 second
>>> if ( imageToLoad.width == 0 ){ testit() }
>>> else
>>> newwindow = window.open('','',sVarA)
>>> newdocument = newwindow.document
>>> newdocument.write(sToPass)
>>> newdocument.close()
>>> }
>>> //--- End loadit() ---
>>> }
>>> //--- End testit() ---
>>> }
>>> </script>
>>> // =============== End of Script ================
>>>
>>> Call it from HTML by
>>> <a href="#" onclick="newWindow('mypicture.jpg')">
>>> <img src="mypicture_t.jpg" alt=" ">My picture</a>
>>> Change:
>>> 'mypicture.jpg' to the name of your image
>>> "mypicture_t.jpg" to the name of your thumbnail image
>>> 'My picture' to your caption
>>>
>>> You can change the position of the page by left and top in this line
>>> sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width
>>> + ",height=" + imageToLoad.height)
>>>
>>> I found it works quite nicely.
>>>
>>> Steve, hope you don't mind. I think the script is great.
>>> I have modified it myself (see my website) to place the background
>>> image in a grey box, centered horizontally, with grey rounded corners,
>>> but that's just an added bell (or is a whistle?) Marc, I can send
>>> details of how to do this, but the rounded corners are a bit tricky.
>>>
>>> --
>>> Cheers,
>>> Trevor L.
>>> Website: http://tandcl.homemail.com.au
>>>

>>
>>

>
>



 
Reply With Quote
 
Murray
Guest
Posts: n/a
 
      21st Feb 2006
And, for what it's worth, js support didn't become standard until well after
Mosaic. NN3, I believe, was the first of the big ones to add it.

--
Murray
--------------
MVP FrontPage


"Trevor L." <Trevor L.@Canberra> wrote in message
news:%(E-Mail Removed)...
> Steve Easton wrote:
>> JavaScript that's been around since the days of Mosaic,

>
> Not quite English, I'm afraid.
> Mo·sa·ic (m-zk)
> adj.
> Of or relating to Moses or the laws and writings attributed to him.
>
> As mosiac is an adjective, I think you mean:
> "since Mosaic days,"
>
> Just having fun. No offense intended
> --
> Cheers,
> Trevor L.
> Website: http://tandcl.homemail.com.au
>
>



 
Reply With Quote
 
=?Utf-8?B?S2l0dHlLYXQ=?=
Guest
Posts: n/a
 
      4th May 2006
I have a similar question. I wish toopen my web site in a maximized state
from the start. Can you help please.


"Murray" wrote:

> It does - what I'm more concerned about is having the Mac dynamically resize
> the page based on the image's size. That has been problematic in the past -
> something about how the Mac manages images or something....
>
> --
> Murray
> --------------
> MVP FrontPage
>
>
> "Steve Easton" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Hi Murray,
> > As Trevor mentioned this is just something I've been playing with because
> > I think it's possible to point a script at a folder full of images and
> > create the links "on the fly."
> >
> > That said. I've not tried it on a Mac. But, if a Mac supports JavaScript
> > that's been around since the days of Mosaic, it "should work."
> >
> >
> > --
> > Steve Easton
> > Microsoft MVP FrontPage
> > 95isalive
> > This site is best viewed............
> > .......................with a computer
> >
> >
> >
> > "Murray" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> >> Trevor - have you or Steve tried this on Macs?
> >>
> >> --
> >> Murray
> >> --------------
> >> MVP FrontPage
> >>
> >>
> >> "Trevor L." <Trevor L.@Canberra> wrote in message
> >> news:(E-Mail Removed)...
> >>> MarcParnes wrote:
> >>>> Hi,
> >>>> I have a thumbnail that opens a smallish picture in a new browser
> >>>> window. I'd like to control the size of the new window so its about
> >>>> the same size as the picture. Now it opens up a fullscreen window
> >>>> which dwarfs the picture. I've seen other sites that do that but I
> >>>> can't figure out how to do it in FP. Can someone help please?
> >>>>
> >>>> Thanks,
> >>>> Marc
> >>>
> >>> Marc,
> >>> FP won't do it by itself, but Steve Easton (MVP) and I have been having
> >>> a discussion over many threads about a script that will do it.
> >>>
> >>> Steve's script is below, with one small change (only he will know what
> >>> it is).
> >>> Go to Code or HTML view and paste it between <head> and </head>:
> >>> // =============== Script to paste ================
> >>> <script type="text/javascript">
> >>> var img , imageToLoad , sVarA , sVarRS
> >>> var newwindow , newdocument , sToPass
> >>> function newWindow(img)
> >>> {
> >>> imageToLoad = new Image()
> >>> new function testit()
> >>> {
> >>> imageToLoad.src = (img)
> >>> // we need a little pause while the script gets the image since the
> >>> image is on the server,
> >>> // or the browser will open the window and write the script before
> >>> the image is cached,
> >>> // which causes the script to write zeros for the resizeto
> >>> dimensions.
> >>> setTimeout(loadit,1000)
> >>> //--- Internal function ---
> >>> function loadit()
> >>> {
> >>> sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width
> >>> + ",height=" + imageToLoad.height)
> >>> sVarRS = 'onload="resizeTo(' + imageToLoad.width + ',' +
> >>> imageToLoad.height + ')"'
> >>>
> >>> sToPass='<html><head>\n'
> >>> + '<style type="text/css"> body{ background-repeat:
> >>> no-repeat; }</style>\n'
> >>> + '<title>' + img + '</title>\n'
> >>> + '</head>\n'
> >>> + '<body ' + sVarRS + ' background=' + img + '>\n'
> >>> + '</body></html>'
> >>> //check to see if we have the dimensions and if not, go back and
> >>> wait another 1 second
> >>> if ( imageToLoad.width == 0 ){ testit() }
> >>> else
> >>> newwindow = window.open('','',sVarA)
> >>> newdocument = newwindow.document
> >>> newdocument.write(sToPass)
> >>> newdocument.close()
> >>> }
> >>> //--- End loadit() ---
> >>> }
> >>> //--- End testit() ---
> >>> }
> >>> </script>
> >>> // =============== End of Script ================
> >>>
> >>> Call it from HTML by
> >>> <a href="#" onclick="newWindow('mypicture.jpg')">
> >>> <img src="mypicture_t.jpg" alt=" ">My picture</a>
> >>> Change:
> >>> 'mypicture.jpg' to the name of your image
> >>> "mypicture_t.jpg" to the name of your thumbnail image
> >>> 'My picture' to your caption
> >>>
> >>> You can change the position of the page by left and top in this line
> >>> sVarA = ("left=20px" + ",top=20px" + ",width=" + imageToLoad.width
> >>> + ",height=" + imageToLoad.height)
> >>>
> >>> I found it works quite nicely.
> >>>
> >>> Steve, hope you don't mind. I think the script is great.
> >>> I have modified it myself (see my website) to place the background
> >>> image in a grey box, centered horizontally, with grey rounded corners,
> >>> but that's just an added bell (or is a whistle?) Marc, I can send
> >>> details of how to do this, but the rounded corners are a bit tricky.
> >>>
> >>> --
> >>> Cheers,
> >>> Trevor L.
> >>> Website: http://tandcl.homemail.com.au
> >>>
> >>
> >>

> >
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Controlling the Access Window size Bob Bridges Microsoft Access VBA Modules 1 25th Aug 2008 10:24 PM
Controlling window size on RDP host =?Utf-8?B?SmFjb2JN?= Windows XP Work Remotely 0 28th Mar 2007 12:20 AM
controlling window size Ron Patterson Microsoft Word New Users 0 23rd Jan 2005 10:05 PM
Controlling Window Size Remulac Microsoft VB .NET 2 21st Jul 2004 04:13 PM
Controlling window size when opening form etc... Elwin Microsoft Access Forms 0 11th Jul 2003 04:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:59 AM.