Jump to content
xisto Community
Sign in to follow this  
alexia

Javascript Window.open Plz help me ,, thanks

Recommended Posts

When I try to run the following code in Internet Explorer I get an "Invalid argument" error but it works fine on Firefox

window.open("users/ve_edit.php","edit av","toolbar=no,location=no,directories=no,status=no,sc rollbars=no,resizable=no,copyhistory=no,width=600, height=400");
plz help me :P

Share this post


Link to post
Share on other sites
window.open("Sample.htm",null,    "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
Note, the null after the filename and remove all spaces between commas (taken from Microsoft's website, so it must work with IE).

Share this post


Link to post
Share on other sites

As I mentioned somewhere else around here before, the WindowName portion of the open call should only contain alphanumeric characters (A-Z,0-9) or underscores (_).

eg. "edit_av" should be changed to either "edit av", "editAv" or similar...

 

Also, as Tyssen and MarCrush suggest, the comma separated list of WindowFeatures must not contain any spaces between options.

 

Notice from Rejected:
Changed "edit av" to "edit_av" :P
Edited by rejected (see edit history)

Share this post


Link to post
Share on other sites

It is always nice to have an existing library of functions to serve your needs, and this is one of mine:

function OpenSubWin( page, w, h, sb ){  var sw = screen.width, sh = screen.height;   var ulx = ((sw-w)/2), uly = ((sh-h)/2);   var sbt = (sb==1) ? 'yes' : 'no';   var paramz = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars='+sbt+',width='+w+',height='+h+'';   var oSubWin = window.open( "", "SubWin", paramz );   oSubWin.moveTo( ulx, uly );   oSubWin.location.replace( page );}

It not only simplifies the task of opening a new sub-window, but it also centers the sub-window on the users screen!

I hope that helps, enjoy!

Share this post


Link to post
Share on other sites
Popup centeringJavascript Window.open

For centering the popup without a visible movement add this syntax in features on window.Open 'left='+((screen.Width-w)/2)+',top='+((screen.Height-h)/2)and remove "oSubWin.MoveTo( ulx, uly );"

or this function from SystemWisdom modified  

function OpenSubWin( page, w, h, sb ){    var sw = screen.Width, sh = screen.Height;   var ulx = ((sw-w)/2), uly = ((sh-h)/2);   var sbt = (sb==1) ? 'yes' : 'no';   var paramz = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars='+sbt+',width='+w+',height='+h+',left='+ulx+',top='+uly;   var oSubWin = window.Open( "", "SubWin", paramz );  oSubWin.Location.Replace( page );}

-reply by Mihai

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.