FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


form button to open a custom sized new window





nunosilva
hey guys, if you can help me I'd be grateful.
I'm doing a simple login page in PHP, wich, whenever you login, wether it's wrong or right the password. it opens a smaller window saying that.

supose your window is full sized... and you want to open a new window with 1/4 of your screen size...

is that possible? how? I heard that with javascript is possible. how do I put the javascript code in the form code?


thanks
Simulator
I don't quite get what you mean, do you want to open a new window or a frame?
the_furious1
I know you can open it in the new window, to do that just use target=_blank. I'm not sure that you can use java.
SystemWisdom
I wrote this long ago, but I am sure you could tweak it to calculate the size of the window to create using percentages.. use the screen.width and screen.height properties to find 1/4 of the size of something.. It also centers the opened sub window on the screen too, kinda handy..


Anyway:

Code:

<html>
<head>
<script language="JavaScript"><!--
function OpenSubWin( szPage, w, h )
{  if( !oNewWin || oNewWin.closed )
   {  var sw = screen.width, sh = screen.height;
      var ulx = ((sw-w)/2), uly = ((sh-h)/2);

      var paramz = 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,resizable=yes,scrollbars=yes';
      var oNewWin = window.open( "", "SubWindow", paramz );
   
      oNewWin.blur();
      oNewWin.moveTo( ulx, uly );
      oNewWin.resizeTo( w, h );
      oNewWin.location.replace( szPage );
   }
   oNewWin.focus();
}
//--></script>
</head>
<body>

<br /><a href="javascript:OpenSubWin( 'http://www.msn.com', 500, 400 )">Open Window</a>

</body>
</html>



Hope that helps...
friscofrankie
nunosilva wrote:

is that possible? how? I heard that with javascript is possible. how do I put the javascript code in the form code?

thanks

Me thinks the java code would have to go into the script handling the form input, not the form itself. Only here will you have the status of the login attempt. It should then be simple to present,
if(success){success.msg}else{fail.msg}
type of logic.
this could be controlled by PHP conditionally wrting the proper script to the browser or by passing the results to the script presenting the data with a window.open
OR..
The new page could be sent out by php completely with java only resizing it onload..
OR...

lots of choices man defne what it is you want to do and you can probably make it happen.
Related topics
751 Useful Windows XP Files
About Google Ads....
Opening page in new window
Problem opening Google from my site
Do you think there are wizards and magic in this world?
local search feature
How to click an image/new window problem
New Window- seen as pop-up?
FEEDBACK PLEASE! My art glass website.
New Window
popup for website !
How to make desktop link for firefox open in new window?
Javascript to launch new window with attributes
Cannot open folder in same window
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.