JavaScript and Buttons


Suppose that in a movie, you wish a user, clicking a button, 'd open a new window in the browser but this window must have its size well defined to contain an image.
Suppose the button has been built. For instance,

Reduce the button tree :

In the right zone, click tab Actions, then Add Event, then On Press
Then click Add Action, then JavaScript

The purpose, while clicking button, is to call the script plan.php in a new page with a fixed size.
( Right here, we don't worry with the position of the window on screen )
Then, in the edit field named Javascript, enter'','newwin', 'width=681,height=681, toolbar=no,location=no,directories=no, status=no,menubar=no,scrollbars=yes,resizable=no');

The content of the script plan.php could be, for instance :
<HTML><BODY marginwidth='0' topmargin='0' leftmargin='0' marginheight='0'> <IMG SRC='swish/images/plan1.jpg' width='681' height='681' border='0'> </BODY></HTML>

And, as a bonus, same thing, centered on screen :'','newwin', 'width=681,height=681, toolbar=no,location=no,directories=no, status=no,menubar=no,scrollbars=yes,resizable=no, top='+((screen.availHeight/2)-(681/2))+',left='+((screen.availWidth/2)-(681/2))+'');


Page chargée en 0.001 sec.

Dernière Modification : Jeu 12 Mai 2022 10:33
Copyright © 1999-2022 Jean-Paul Molina Tous droits réservés.


to Google