• Das Erstellen neuer Accounts wurde ausgesetzt. Bei berechtigtem Interesse bitte Kontaktaufnahme über die üblichen Wege. Beste Grüße der Admin

Probleme mit Banner-Rotator

KlausVMC

New member
Hallo,
habe folgenden Banner-Rotator ausprobiert, der auch einwandfrei funktioniert.

<HTML>
<HEAD>
<TITLE>Rotating Advertisements</TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">


// global variable for current sponsor
var sponsor = 1;

// function to link to appropriate sponsor
// (for demonstration, displays a dialog instead)
function GoSponsor() {
if (sponsor==1) window.location.href="aktion1.htm";
if (sponsor==2) window.location.href="aktion2.htm";
if (sponsor==3) window.location.href="aktion3.htm";
}

// function to rotate image (currently uses 3 images)
function rotate() {
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "banner_" + sponsor + ".jpg";
window.setTimeout('rotate();',5000);
}


</SCRIPT>
<BODY onLoad="window.setTimeout('rotate();',5000);">
<body bgcolor="ffffff">
<A HREF="javascript:GoSponsor();">
<IMG NAME="banner" SRC="banner_1.jpg" border=0>
</A>


</body></html>

Wenn ich dieses Script nun in die Seite einbaue funktioniert das Rotieren des Banners nicht mehr.

<script language="JavaScript">
<!--
function MM_showHideLayers() { //v2.0
var i, visStr, args, theObj;
args = MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) { //with arg triples (objNS,objIE,visStr)
visStr = args[i+2];
if (navigator.appName == 'Netscape' && document.layers != null) {
theObj = eval(args);
if (theObj) theObj.visibility = visStr;
} else if (document.all != null) { //IE
if (visStr == 'show') visStr = 'visible'; //convert vals
if (visStr == 'hide') visStr = 'hidden';
theObj = eval(args[i+1]);
if (theObj) theObj.style.visibility = visStr;
} }
}
//-->
</script>

<SCRIPT LANGUAGE="JavaScript">


// global variable for current sponsor
var sponsor = 1;

// function to link to appropriate sponsor
// (for demonstration, displays a dialog instead)
function GoSponsor() {
if (sponsor==1) window.location.href="aktion1.htm";
if (sponsor==2) window.location.href="aktion2.htm";
if (sponsor==3) window.location.href="aktion3.htm";
}

// function to rotate image (currently uses 3 images)
function rotate() {
if (++sponsor > 3) sponsor = 1;
document.images[0].src = "banner_" + sponsor + ".jpg";
window.setTimeout('rotate();',5000);
}


</SCRIPT>

</head>

<BODY onLoad="window.setTimeout('rotate();',5000);">
<body bgcolor="#FFFFFF">

<center>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0 >
<tr>
<td><img src="images/p.gif" nosave height=1 width=540></td>
</tr>
<tr>
<td> <img SRC="images/p.gif" NOSAVE height=1 width=264><a href="c_region.htm" onMouseOver="MM_showHideLayers('document.layers[\'Region\']','document.all[\'Region\']','show','document.layers[\'AllesBio\']','document.all[\'AllesBio\']','hide','document.layers[\'Kontakt\']','document.all[\'Kontakt\']','hide','document.layers[\'Produkte\']','document.all[\'Produkte\']','hide','document.layers[\'Info\']','document.all[\'Info\']','hide','document.layers[\'News\']','document.all[\'News\']','hide','document.layers[\'Wir\']','document.all[\'Wir\']','hide','document.layers[\'Forum\']','document.all[\'Forum\']','hide')"><img SRC="images/bh_1.jpg" NOSAVE height=43 width=91 border="0"></a>
</td>
</tr>
<tr>
<td><img SRC="images/p.gif" NOSAVE height=1 width=275><a href="b_produkte.htm" onMouseOver="MM_showHideLayers('document.layers[\'Region\']','document.all[\'Region\']','hide','document.layers[\'AllesBio\']','document.all[\'AllesBio\']','hide','document.layers[\'Kontakt\']','document.all[\'Kontakt\']','hide','document.layers[\'Produkte\']','document.all[\'Produkte\']','show','document.layers[\'Info\']','document.all[\'Info\']','hide','document.layers[\'News\']','document.all[\'News\']','hide','document.layers[\'Wir\']','document.all[\'Wir\']','hide','document.layers[\'Forum\']','document.all[\'Forum\']','hide')"><img SRC="images/bh_2.jpg" NOSAVE height=28 width=108 border="0"></a></td>
</tr>
<tr>
<td><img SRC="images/p.gif" NOSAVE height=1 width=190><a href="index.htm" onMouseOver="MM_showHideLayers('document.layers[\'Region\']','document.all[\'Region\']','hide','document.layers[\'AllesBio\']','document.all[\'AllesBio\']','show','document.layers[\'Kontakt\']','document.all[\'Kontakt\']','hide','document.layers[\'Produkte\']','document.all[\'Produkte\']','hide','document.layers[\'Info\']','document.all[\'Info\']','hide','document.layers[\'News\']','document.all[\'News\']','hide','document.layers[\'Wir\']','document.all[\'Wir\']','hide','document.layers[\'Forum\']','document.all[\'Forum\']','hide')"><img SRC="images/bh_3.jpg" NOSAVE height=117 width=350 border="0"></a></td>
</tr>
<tr>
<td><img SRC="images/p.gif" NOSAVE height=1 width=228><a href="e_kontakt.htm" onMouseOver="MM_showHideLayers('document.layers[\'Region\']','document.all[\'Region\']','hide','document.layers[\'AllesBio\']','document.all[\'AllesBio\']','hide','document.layers[\'Kontakt\']','document.all[\'Kontakt\']','show','document.layers[\'Produkte\']','document.all[\'Produkte\']','hide','document.layers[\'Info\']','document.all[\'Info\']','hide','document.layers[\'News\']','document.all[\'News\']','hide','document.layers[\'Wir\']','document.all[\'Wir\']','hide','document.layers[\'Forum\']','document.all[\'Forum\']','hide')"><img SRC="images/bh_4.jpg" NOSAVE height=38 width=119 border="0"></a></td>
</tr>
<tr>
<td><img SRC="images/p.gif" NOSAVE height=1 width=190><a href="f_forum.htm" onMouseOver="MM_showHideLayers('document.layers[\'Region\']','document.all[\'Region\']','hide','document.layers[\'AllesBio\']','document.all[\'AllesBio\']','hide','document.layers[\'Kontakt\']','document.all[\'Kontakt\']','hide','document.layers[\'Produkte\']','document.all[\'Produkte\']','hide','document.layers[\'Info\']','document.all[\'Info\']','hide','document.layers[\'News\']','document.all[\'News\']','hide','document.layers[\'Wir\']','document.all[\'Wir\']','hide','document.layers[\'Forum\']','document.all[\'Forum\']','show')"><img SRC="images/bh_5.jpg" NOSAVE height=43 width=127 border="0"></a></td>
</tr>
<tr>
<td><img SRC="images/p.gif" NOSAVE height=1 width=179><a href="g_info.htm" onMouseOver="MM_showHideLayers('document.layers[\'Region\']','document.all[\'Region\']','hide','document.layers[\'AllesBio\']','document.all[\'AllesBio\']','hide','document.layers[\'Kontakt\']','document.all[\'Kontakt\']','hide','document.layers[\'Produkte\']','document.all[\'Produkte\']','hide','document.layers[\'Info\']','document.all[\'Info\']','show','document.layers[\'News\']','document.all[\'News\']','hide','document.layers[\'Wir\']','document.all[\'Wir\']','hide','document.layers[\'Forum\']','document.all[\'Forum\']','hide')"><img SRC="images/bh_6.jpg" NOSAVE height=40 width=85 border="0"></a></td>
</tr>
<tr>
<td><img SRC="images/p.gif" NOSAVE height=1 width=114><a href="h_news.htm" onMouseOver="MM_showHideLayers('document.layers[\'Region\']','document.all[\'Region\']','hide','document.layers[\'AllesBio\']','document.all[\'AllesBio\']','hide','document.layers[\'Kontakt\']','document.all[\'Kontakt\']','hide','document.layers[\'Produkte\']','document.all[\'Produkte\']','hide','document.layers[\'Info\']','document.all[\'Info\']','hide','document.layers[\'News\']','document.all[\'News\']','show','document.layers[\'Wir\']','document.all[\'Wir\']','hide','document.layers[\'Forum\']','document.all[\'Forum\']','hide')"><img SRC="images/bh_8.jpg" NOSAVE height=34 width=123 border="0"></a></td>
</tr>
<tr>
<td><a href="d_wir.htm" onMouseOver="MM_showHideLayers('document.layers[\'Region\']','document.all[\'Region\']','hide','document.layers[\'AllesBio\']','document.all[\'AllesBio\']','hide','document.layers[\'Kontakt\']','document.all[\'Kontakt\']','hide','document.layers[\'Produkte\']','document.all[\'Produkte\']','hide','document.layers[\'Info\']','document.all[\'Info\']','hide','document.layers[\'News\']','document.all[\'News\']','hide','document.layers[\'Wir\']','document.all[\'Wir\']','show','document.layers[\'Forum\']','document.all[\'Forum\']','hide')"><img SRC="images/bh_7.jpg" NOSAVE height=41 width=179 border="0"></a></td>
</tr>
</table>
</center>
<font face="Arial"></font>
<center>
<A HREF="javascript:GoSponsor();">
<IMG NAME="banner" SRC="banner_1.jpg" border=0>
</A>

Ich habe festgestellt, das es irgendwie mit den Tabellen zusammenhängt. Kann mir jemand weiterhelfen. Vielen Dank im voraus.

Tschau, Klaus
 
hi KlausVMC,

habe es mit IE und NC ausprobiert geht wunderbar wenn du
diesen Banner-Rotator verwendest.

zwischen <head>...</head>

<script language="JavaScript" type="text/javascript">
<!--
var anzahl = 2;
var sctr = 0;
var halt = 0;

var isn = new Array();
for (i=0; i<anzahl; i++) {
isn=new Image();
}
isn[0].src="banner1.gif";
isn[1].src="banner2.gif";

var durl = new Array();
durl[0]="http://people.freenet.de/rene.marscheider/";
durl[1]="http://home.t-online.de/home/soundtrust/";

function rotateIt() {
if (halt!=1) {
sctr++;
if (sctr>anzahl-1) {
sctr=0;
}
document.banner.src=isn[sctr].src;
setTimeout("rotateIt()",5000);
}
}

function doIt() {
halt=1;
location.href = durl[sctr];
}

function dispIt() {
window.status = durl[sctr];
}
setTimeout("rotateIt()",5000);
//-->
</script>

zwischen <body...>...</body>

<a href="#" onClick="doIt(); return false;" onMouseover="dispIt(); return true;" onmouseout="window.status=' '; return true;"><img name="banner" src="banner1.gif" border="0"></a>



In den <body...> brauchst du für den Rotator kein onload="..." einfügen.

gruss
René


[Edited by René on 10-10-2000 at 11:28]
 
Zurück
Oben