JavaScript Kit

Home / Free JavaScripts / Images & Music / Here

Cut & Paste Pop-up ad banner script

Credit: JavaScript Kit

Description: A script that loads a pop up window with the specified banner inside. Clicking the banner will load the target URL in the main window while closing the pop up at the same time. Note that this script does NOT dynmically rotate through a set of banners- it works with an existing banner rotation code, such as LinkExchange.

Example:

Directions

Step 1: Insert the below into the <head> section of the page that will load the pop up (ie: this page):

Step 2: Copy the entire code below and save it as "popup.htm", under the same directory as the page in Step 1. This is the page that will get loaded into the pop up window. It contains both the script required to load the target URL into the main window, plus a sample Link Exchange code. Change the LinkExchange code to your own banner's code. You can in general edit any part of the below code EXCEPT the parts in red. They should be perserved. The code onClick="loadurl(this.href);return false" should be inserted inside the <a> tag of your banner code, like below.

<html>
<head>
<title>Please support our sponsor!</title>
</head>
<body bgcolor="#FFFFFF">

<p align="left">

<script>
function loadurl(url){
window.creator.location=url
window.close()
}
</script>


<a href="http://ad.linkexchange.com/1/X348076/gotoad.map" target="_top" onClick="loadurl(this.href);return false"><img
width="440" height="40" border="1" ismap alt="LinkExchange"
src="http://ad.linkexchange.com/1/X348076/logoshowad?free"></a>


</p>
</body>
</html>


[an error occurred while processing this directive]

Copyright © 1997-2014 JavaScript Kit. NO PART may be reproduced without author's permission.