 |
 |

05-18-2007, 05:08 PM
|
|
Junior Member
|
|
Join Date: May 2007
Posts: 3
|
|
Javascript multiple popups on one page
Greetings all.
I'm a complete novice at creating the Javascript necessary for installing popup links on a page, so when I found the "Ace Popup Generator" I nearly turned cartwheels.
Then, upon putting it to the test, I discovered that the software seems designed with the assumption that only one popup would be desired in a page.
I am attempting to put together a webpage containing multiple popup links, all to different page sources and to be manually viewed at will.
Is there some tweaking of the script that goes in between the <head> and</head> tags that must be done to allow for the engaging of multiple page-sources of popups in one page?
Opey
|

05-18-2007, 07:47 PM
|
|
Member
|
|
Join Date: Nov 2005
Posts: 70
|
|
Of course you can use multiple popup on the same page.
The script part you put between de head tags is always the same.
This script uses mypage,myname,w,h,pos,infocus as parameter.
These are : the page you call , the name you give, the size of the popup, its position and the focus it gets.
So each call has its own set of variable, allowing you to define different calls for different popups
The only part you need to modify for each popup is the
HTML Code:
<a href="javascript:acePopup('http://www.yourdomain.com/page.html','acePopup','300','400','','front');">Click Here</a>
Hope this helps
Pierre
|

05-18-2007, 11:45 PM
|
|
Junior Member
|
|
Join Date: May 2007
Posts: 3
|
|
Re: Javascript multiple popups on one page
Hi Pierre,
Thanks much for your reply.
When the Ace Popup Generator generates the script code which it instructs must be placed between the <header></header> tags, it seems to indicate, by the last line in that script code, that that script is tailored to be referencing just the one popup (at: http://www.yourdomain.com/aub1.html) whose code I get generated first. Please scroll down to see the last line of that script that I copied from the Generator (I substituted "yourdomain.com" for privacy purposes). This is what that last line below is: (();acePopupWindow.location='http://www.yourdomain.com/aub1.html';}
When the Generator generates the code for a second popup (at: http://www.yourdomain.com/aub2.html) which it instructs is to go between the <header></header> tags, then the last line of that second generated code is referencing the aub2.html.
What am I supposed to do with the second code generated and which the Ace Popup Generator instructs must go between the <header></header> tags again?
When I place the javascript code for the link for the aub2.html in my chosen spot on my page, uploaded testing of that link results in the loading of the aub1.html popup instead of the aub2.html popup.
Do I need to modify/tweak the script that is initially generated for the first popup and which goes between the <header></header> tags so that that script applies successfully to each and every other popup that I subsequently get generated?
Opey
<script language='javascript'>
<!--
/********************************************
AUTHOR:WWW.CGISCRIPT.NET.LLC
URL:http://www.cgiscript.net
Use the code for FREE but leave this message intact
Download your FREE CGI/Perl Scripts today!
( http://www.cgiscript.net/scripts.htm )
************************************************** **/
var acePopupWindow=null;
function acePopup(mypage,myname,w,h,pos,infocus){
if(pos=='random'){
LeftPosition=(screen.width)?Math.floor(Math.random ()*(screen.width-w)):100;
TopPosition=(screen.height)?Math.floor(Math.random ()*((screen.height-h)-75)):100;}
if(pos=='center'){
LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!='center' && pos!='random') || pos==null){LeftPosition=100;TopPosition=100;}setti ngs='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no ,status=no,scrollbars=no,resizable=no,dependent=no ';
acePopupWindow=window.open('',myname,settings);
if(infocus=='front'){acePopupWindow.focus();acePop upWindow.location='http://www.yourdomain.com/aub1.html';}
}
//-->
</script>
|

05-20-2007, 06:46 PM
|
|
Member
|
|
Join Date: Nov 2005
Posts: 70
|
|
Yes you are right, you have to change it a little bit:
replace last line
Code:
acePopupWindow.location='http://www.yourdomain.com/aub1.html';}
with
Code:
acePopupwinWindow.location=mypage;}
This way the called window url is passed as parameter.
Hope this helps
Pierre
|

06-04-2007, 07:25 AM
|
|
Junior Member
|
|
Join Date: May 2007
Posts: 3
|
|
Hi Pierre, everyone,
Today I finally got a chance to try out the code you suggested as replacement for the last line of the code generated by the acepopup generator.
The pop up window does appear, so that's good. However, no content is displayed at all. The popup window remains blank.
I then tried alternating the last line of the code designated as "location" with the actual web address pathname, to the very directory housing my webpages that serve as popup content. I tried uploading with and without surrounding ' ' marks surrounding the web address, and surrounding 'mypage'.
I don't know what I'm doing wrong.
Opey
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 09:53 PM.
|