Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pop-up window

Status
Not open for further replies.

z35

Programmer
Dec 21, 2001
206
US
hi,

With the getURL action script, I am opening a page in a new window that is very small in size. I am doing this using a javascript function.

Do I have to write a separate function for each pop-up window?

If anyone is familiar with this please let me know. thanks for any help!
 
You can define any number of parameters in your java function... Here in bold:

function NewWindow(url,h,w) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops =
'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
win = window.open(url, 'win', winprops);
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

Then in Flash, you would use those parameters:

on (press) {
getURL ("javascript:NewWindow('}

The above would open a popup 400 pixels high and 372 pixels wide, holding the content of des1.html. This popup would also be centered in the browser window.

Regards,
wink4.gif
ldnewbie
 
except aols window..top left regardless..
logo.gif


carlsatterwhite@orlandomediasolutions.com
 
hi ldnewbie

this looks way complex....i dunno if u misunderstood my question. i'll look at what you wrote in detail but anyway,
my question is...

i am writing a separate function for each window...like

<script language=&quot;javascript&quot;>
function A()
{
window.open(&quot;new win photos/327X.jpg&quot;,&quot;_blank&quot;,&quot;directories=0,scrollbars=0,toolbars=0,location=0,width=691,height=846,left=0,top=0&quot;);
}
</script>

and then agian i write...

<script language=&quot;javascript&quot;>
function B()
{
window.open(&quot;new win photos/328X.jpg&quot;,&quot;_blank&quot;,&quot;directories=0,scrollbars=0,toolbars=0,location=0,width=691,height=846,left=0,top=0&quot;);
}
</script>

do i write the script all over again for image 327X.jpg and for 328X.jpg?

 
I was merely saying that rather than writing severals functions (one for each image), you can use one generic function [i.e. function NewWindow(parameter,parameter,parameter...)]and then pass those parameters from Flash to the function.

Regards,
new.gif
 
hi oldnewbie,

ok...i get you now. thank you for this idea.

i would like the window to be placed at the top left (0,0).

so i will edit out
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;

right?

and what is this by the way:
if (parseInt(navigator.appVersion) >= 4) { win.window.focus();

 
Right you are!
Or you can simply set
var winl = 0;
var wint = 0;

You can also get rid of the line:
if (parseInt(navigator.appVersion) >= 4) { win.window.focus();

If I correctly remember, it just sets focus on the new opened window, on browsers version 4 and higher. Otherwise, I believe, focus would remain on the main browser window.

Regards,
new.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top