kramer336
12-09-2002, 08:42 PM
Here is a script Ive been playing around with. It will randomly display a banner at the top of a page. Im stuck on how to make the links for the banners open in a new blank window. Can anyone help?
Here is the HTML link... http://www.saweddings.com/*****enbanner.htm
Im pretty sure,,, its just one simple line.. but im not sure~!~
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script language="JavaScript">
i = 2 // Number of banners that you have
banner1= new Image();
banner1.src = "http://saweddings.com/images/Banners/animated-bannergif.gif";
banner2 = new Image();
banner2.src = "http://saweddings.com/images/mock-banner.gif";
links = new Array
links[1] = "http://simonsaysstudios.com"
links[2] = "http://cnn.com"
description = new Array
description[1] = "LINK DESCRIPTION #1"
description[2] = "LINK DESCRIPTION #2"
function randombanner(){
var randomnumber = Math.random();
i = Math.round( (i - 1) * randomnumber) + 1;
document.banner.src = eval("banner" + i + ".src");
}
function startTime(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
closeTime=hours*3600+mins*60+secs;
closeTime+=7; // How many seconds til the next rotation
Timer();
}
function Timer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
curTime=hours*3600+mins*60+secs
if (curTime>=closeTime){
if (i < 2){ // The number 2 is the amount of banners that you have
i++;
document.banner.src = eval("banner" + i + ".src");
}
else{
i = 1;
document.banner.src = eval("banner" + i + ".src");
}
startTime();
}
else{
window.setTimeout("Timer()",1000)}
}
function clickLink(){
top.location = links[i]
}
function descript(){
window.status = description[i]
}
// -->
</script>
</head>
<body onLoad="randombanner(); startTime();">
<a href="" onClick="clickLink(); return false;" onMouseOver="descript(); return true;" onMouseOut="window.status=''">
<img src="images/Banners/animated-bannergif.gif" border=0 name="banner" width="468" height="60"></a>
</body>
</html>
OPPS NO CURSING>.. http://www.saweddings.com/bnbanner.htm
Here is the HTML link... http://www.saweddings.com/*****enbanner.htm
Im pretty sure,,, its just one simple line.. but im not sure~!~
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script language="JavaScript">
i = 2 // Number of banners that you have
banner1= new Image();
banner1.src = "http://saweddings.com/images/Banners/animated-bannergif.gif";
banner2 = new Image();
banner2.src = "http://saweddings.com/images/mock-banner.gif";
links = new Array
links[1] = "http://simonsaysstudios.com"
links[2] = "http://cnn.com"
description = new Array
description[1] = "LINK DESCRIPTION #1"
description[2] = "LINK DESCRIPTION #2"
function randombanner(){
var randomnumber = Math.random();
i = Math.round( (i - 1) * randomnumber) + 1;
document.banner.src = eval("banner" + i + ".src");
}
function startTime(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
closeTime=hours*3600+mins*60+secs;
closeTime+=7; // How many seconds til the next rotation
Timer();
}
function Timer(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
curTime=hours*3600+mins*60+secs
if (curTime>=closeTime){
if (i < 2){ // The number 2 is the amount of banners that you have
i++;
document.banner.src = eval("banner" + i + ".src");
}
else{
i = 1;
document.banner.src = eval("banner" + i + ".src");
}
startTime();
}
else{
window.setTimeout("Timer()",1000)}
}
function clickLink(){
top.location = links[i]
}
function descript(){
window.status = description[i]
}
// -->
</script>
</head>
<body onLoad="randombanner(); startTime();">
<a href="" onClick="clickLink(); return false;" onMouseOver="descript(); return true;" onMouseOut="window.status=''">
<img src="images/Banners/animated-bannergif.gif" border=0 name="banner" width="468" height="60"></a>
</body>
</html>
OPPS NO CURSING>.. http://www.saweddings.com/bnbanner.htm