loading javascript

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

I am loading a javascript function from my asp.net app.
This function loads a string passed to it in a new window.

I register the function to activate on click of an asp
linkbutton. Now when ever I click the link button the
window pops up with the string passed to it but it gets
minimised automatically.

Even using win.focus() does'nt seem to stop it from
minimising. How can I stop this from happening

Regards,

Terry W
 
Hi Terry,

Could you post the javascript function you are using to launch the window.
Thanks. Ken.
 
function showPopup()
{
/*------------var win;
if(typeof(win) != "undefined" && win.closed == false)
{
win.close();
} ------------ */
var winTop = (screen.height/2) - 125;
var winLeft = (screen.width/2) - 125;

var winFeatures = "width=260,height=240,";

winFeatures = winFeatures + "left = "+winLeft+",";

winFeatures = winFeatures +"top = "+winTop;

winFeatures = winFeatures +"location=no, menubar=no,
status=no,";
winFeatures = winFeatures +"toolbar=no,
scrollbars=no,resizable=no,";
winFeatures = winFeatures +"copyHistory=no";

win = window.open("PopupForm.aspx?note=This is a
test&load=true","My Test",winFeatures);

win.focus();
}
 
Hi Terry,

I changed it a little bit and this version works for me. Basically I used
';' semicolons between the winFeatures arguements instead of ',' commas.
Also in the window.open() function I took out the space between "My Test",
you can't have a space in that arguement. The new code is below. Good
luck! Ken.

function showPopup()
{
/*------------var win;
if(typeof(win) != "undefined" && win.closed == false)
{
win.close();
} ------------ */
debugger;
var winTop = (screen.height/2) - 125;
var winLeft = (screen.width/2) - 125;

var winFeatures = "width=260;height=240;";

winFeatures = winFeatures + "left="+winLeft+";";

winFeatures = winFeatures +"top="+winTop;

winFeatures = winFeatures +";location=no;menubar=no;status=no;";
winFeatures = winFeatures +"toolbar=no;scrollbars=no;resizable=no;";
winFeatures = winFeatures +"copyHistory=no";

win = window.open("QuoteHistory.aspx?note=This is a
test&load=true","MyTest",winFeatures);

win.focus();
}
 
Thanks for that ken

I have tried that but it still gets minimised and also
now the height of the window is equal to screen height

I have replaced the comma's but as I am writing this
function in ASP.NEt i am using \" for quote's

"winFeatures = winFeatures + \"left = \"+winLeft+\";\";

can I use ' instead of \"

what is going wrong here

thanks for your help

Best Regards
 
Hi Terry,

I don't know what I was thinking. "," are fine, switch back to that. With
the commas in your script works perfect on my system, and the space taken
out of "MyTest". Windows 2000, IE 6, latest patches applied. Have you
tried this from another computer? You might have some 3rd party popup stuff
going on, or maybe XP does something different and minimizes popups by
default. You might want to check the advanced settings of whatever browser
you are using to see if there is a setting checked that automatically
minimizes popups. Your script is fine though. Good luck! Ken.
 
Ken,

I have got a similiar script which opens a popup in
a .js file and it opens and stays centered on the screen.

It is just this window which I register as a clientside
script from within my ASP application that minimises

Do you think it is something to do with a post back..
 
Hi Terry,

I don't think it has anything to do with a post back. Do you have any
javascript running in the popup window you load? Or any javascript from the
opener window that runs after you call your showPopup() function? If your
main window does more javascript stuff after doing the popup then maybe it
is taking back focus and minimizing your popup. Maybe try putting a test
button on your page and add this attribute, that's how I ran your function:

Attributes.Add("onclick", "showPopup(); return false;")

If it doesn't fix the problem then the only thing I can think of is
javascript is running in the new popup that is doing something. I don't
think the problem can occur from a problem on the server. Good luck! Ken.
 
Back
Top