PDA

View Full Version : banner/image randomizer that then opens a resized html window on click (size=290x164)



garrettb
07-16-2008, 04:29 PM
I would like to combine the two scripts to work together. Any help would be greatly appreciated.



I need an banner/image randomizer that then opens a resized html window on click (size=290x164) with no tool bars & no scroll



Sample html documents

-----------------------------------------------------------------------------



<html>
<head>
<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/JavaScript" src="js/rotation.js"></script><!-- Popup window -->
<script type="text/JavaScript" src="js/popup.js"></script><!-- Popup window -->

</head>
<body onload="window.name = 'pbmain';">

<a href="folder/document.html" onclick="NewWindow(this.href,'coupon','300','270','no','center');return false" onfocus="this.blur()"><img src="images/folder/image_name.jpg" width="290" height="164" border="0"></a>

</body>
</html>

-----------------------------------------------------------------------------


<html>
<head>
<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/JavaScript" src="js/rotation.js"></script><!-- Popup window -->
<script type="text/JavaScript" src="js/popup.js"></script><!-- Popup window -->

</head>

<body onload="window.name = 'pbmain';">

<script type="text/JavaScript" src="folder/rotation.js"></script>

</body>
</html>


-----------------------------------------------------------------------------
Here is the rotation script


<!-- Begin
rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};

function rand(number) {
var result = Math.ceil(rnd()*number);
if (!result)result++;
return result
};
var ad_cnt4 = 8;
var ad4 = rand(ad_cnt4);
var link4;
var adBanner4;
var width4
var height4
if (ad4==1) {
link4="http://www.url.com/folder/document.html";
adBanner4="http://www.url.com /folder/image_name1.jpg";
width4="290";
height4="164";
alt4="name_title";
}
if (ad4==2) {
link4="http://www.url.com/folder/document.html";
adBanner4="http://www.url.com /folder/image_name2.jpg";
width4="290";
height4="164";
alt4="name_title";
}
if (ad4==3) {
link4="http://www.url.com/folder/document.html";
adBanner4="http://www.url.com /folder/image_name3.jpg";
width4="290";
height4="164";
alt4="name_title";
}
if (ad4==4) {
link4="http://www.url.com/folder/document.html";
adBanner4="http://www.url.com /folder/image_name4.jpg";
width4="290";
height4="164";
alt4="name_title";
}
document.write('<center><a href="' + link4 + '" target="_blank">');
document.write('<img src="' + adBanner4 + '" width=' + width4 + ' height=' + height4 + ' border=0 alt="' + alt4 + ' "></a>');
document.write('</center>');
// End -->


-----------------------------------------------------------------------------
Popup window resize script


<!--
/****************************************************
Author: Eric King
Url: http://redrival.com/eak/index.shtml
This script is free to use as long as this info is left in
Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
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=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,re sizable=no';
win=window.open(mypage,myname,settings);}
// -->


-----------------------------------------------------------------------------

Jesdisciple
07-17-2008, 05:10 AM
Do you have a guess at how to do this? (Hint: The last part of that rotation script looks kinda familiar...)

magicyte
07-18-2008, 03:06 AM
Are you saying that you CAN'T combine the two scripts?! I can't understand very well... Please be more specific...

-magicyte

P.S. ...

P.P.S. ...

P.P.P.S. lol (el-oh-el) || (laugh out loud)

Jesdisciple
07-18-2008, 02:40 PM
No; I'm saying that I don't want to simply give the answer to someone who hasn't tried to get it on their own.

The first script contains the link you want, and the rotation script also has a link. You should take what you like about each and put the combination in the rotation script.