1 Replies - 646 Views - Last Post: 10 August 2009 - 06:01 AM

#1 Djronlove   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-August 09

Need ability to select popup option

Posted 09 August 2009 - 08:48 PM

Hello,

I have been using this code to allow popup windows within my website. What I'm trying to do is create an option that will assign certain banners open up in a new window and others open in the same page. I also need to be able to assign different window sizes depending on the banner ad. Thanks.

<!--Rotating Banner Script-->
if (document.images)

{
// First create an array with links to the images you want to
// display as banners. I chose 3 image locations.
adImages = new Array
(
"http://www.djronlove.com/_DJRL_Images/_BannerAds/712_webservices.png",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/712_webservices.png",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/712_creditdispute.png",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/712_creditdispute.png",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/banner_reewine.jpg",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/banner_reewine.jpg",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/banner_DITM17.jpg",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/banner_DITM_download.jpg",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/banner_maxonpoint.jpg",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/banner_maxonpoint.jpg",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/banner_mj.png",
"http://www.djronlove.com/_DJRL_Images/_BannerAds/banner_mj.png"
);

// When the user clicks on a banner it should take the user to
// the website of that company. Therefore we create another
// array with a list of URLs. Keep the order the same as images.

adURLs = new Array
(
"www.712groupinc.com/webdesign.html",
"www.712groupinc.com/webdesign.html",
"www.712groupinc.com/credit.html",
"www.712groupinc.com/credit.html",
"www.djronlove.com/_DJRL_FlyerPages/flyer_reewineent.html",
"www.djronlove.com/_DJRL_FlyerPages/flyer_reewineent.html",
"www.djronlove.com/_DJRL_Playlists/playlist_ditm17.html",
"www.djronlove.com/_DJRL_Playlists/playlist_ditm17.html",
"www.djronlove.com/_DJRL_FlyerPages/flyer_thursdays_max.html",
"www.djronlove.com/_DJRL_FlyerPages/flyer_thursdays_max.html",
"www.djronlove.com/_DJRL_Playlists/playlist_mj.html",
"www.djronlove.com/_DJRL_Playlists/playlist_mj.html"
);

thisAd = 0;
}
// The following function cycles through each banner image.
// Notice the use of the variable thisAd to go from 0 to 2 and then
// back to 0. Javascript has an object called document whose
// member adBanner can be set to the current banner to display.

function cycleAds()
{
	if (document.images)
	{
		if (document.adBanner.complete)
		{
			if (++thisAd == adImages.length)
				thisAd = 0;

			document.adBanner.src = adImages[thisAd];
		}
	}

	// change to next banner every 15 seconds
	setTimeout("cycleAds()", 3000);
}
// This function is used to direct the user to the website when
// the user clicks on a particular banner image.

function gotoAd()
{
	window.open("http://" + adURLs[thisAd],"","width=900,height=700,status=yes,toolbar=no,menubar=no,left=100,top=100, scrollbars=yes,resizable=yes");
}
<!--END Rotating Banner Script-->




Is This A Good Question/Topic? 0
  • +

Replies To: Need ability to select popup option

#2 crazyjugglerdrummer   User is offline

  • GAME OVER. NERD WINS.
  • member icon

Reputation: 124
  • View blog
  • Posts: 690
  • Joined: 07-January 09

Re: Need ability to select popup option

Posted 10 August 2009 - 06:01 AM

I think you can just have 1 window size that all the ads will fit in.

Make sure you are actually assigning the properties of the document object before using them. It might be better to use window, as that's the global object.

So you want some to open in the same page in a frame? That would be weird, you'll have to have some sort of flag that tells where to open. :D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1