Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: SV: Re: SV: refreshing and scrolling


Message #1 by "Datatal AB - Gauffin, Jonas" <jonas@d...> on Tue, 12 Nov 2002 11:52:28 +0100
I think that the problem is that the window already is open, because I 
cant think of another reason to why the size wouldn't change.

Do something like this:

[...]
<script language=3DJavaScript>
<!--
windowHandle =3D null;
function openOrReuseWindow(newLocation,sizeX, sizeY)
{
	if (windowHandle =3D=3D null)
	{
		windowHandle.resizeTo(sizeX,sizeY);
		windowHandle.document.location =3D newLocation;
	}
	else
	{
		myHandle =3D window.open(blabla);
	}
}
//-->
</script>
[....]
<a href=3D'javascript("mypicture.php?id=3D1",xx,yy)'>Show pic</a>

Please note that I haven't tested the code, although it should work with 
minor modifications.

Or a more clean way is to combine php/javascript in mypicture.php:
<script language=3DJavaScript>
<!--
function ResizeThis(newLocation,sizeX, sizeY)
{
	window.resizeTo(<?=3D $picWidth ?>,<?=3D $picHeight ?>);
}
//-->
</script>
<body onLoad=3D'ResizeThis()'>

-----Ursprungligt meddelande-----
Fr=E5n: jorge [mailto:jorge@d...]
Skickat: den 12 november 2002 11:55
Till: professional php
=C4mne: [pro_php] Re: SV: refreshing and scrolling


Jonas:
while the theme is Javascript one question
i have made a standar window.open function
to call it on a page several times adjusted to the size of the picture 
it will show Some times the window size wont change and the window will 
open with the dimensions of the first call to the function (the size 
iscached i guess) any ideas??

Jorge
----- Original Message -----
From: "Datatal AB - Gauffin, Jonas" <jonas@d...>
To: "professional php" <pro_php@p...>
Sent: Tuesday, November 12, 2002 1:41 AM
Subject: [pro_php] SV: refreshing and scrolling


> If you use setTimeout and javascript instead it's easy to scrolldown
> to
the last position.
>
> Use this:
>
> <script language=3DJavaScript>
> <!--
> function ReloadPage()
> {
> //set scrolltop to the current position
> document.location =3D "mypage.php?a=3D1&scrolltop=3D" +
> document.body.scrollTop; } function OnLoad()
> {
> //Scroll down to the previous position
> self.scroll(0,<?=3D $_GET['scrolltop'] ?>);
>
> //3000 =3D your timeout.
> setTimeout('ReloadPage()',3000);
> }
> //-->
> </script>
> <body onLoad=3D"OnLoad();">
>
>
> -----Ursprungligt meddelande-----
> Fr=E5n: Olivier Toubia [mailto:toubia@m...]
> Skickat: den 11 november 2002 22:11
> Till: professional php
> =C4mne: [pro_php] refreshing and scrolling
>
>
> I'm using PHP with a MySQL database.
> I want one page to be automatically updated, i.e. to instantly reflect
changes in the database
> without having to hit "refresh". I'm doing this using the command
> <META HTTP-EQUIV=3D"Refresh" CONTENT=3D"1 URL=3D..."> which 
automatically
> refreshes
the page every
> second. However when the page gets larger and the user scrolls down,
> the
page goes back to
> the top each time it refreshes itself, so that you have less than 1
> second
to scroll!
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to
> unsubscribe send a blank email to 
>
>
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to
> unsubscribe send a blank email to 





  Return to Index