Datei.js extern

Weil es so heißt:
<script language="javascript" src="banner.js"></script>


Du hattest da wohl css und js gemischt ... :)



Grüße, Ronin
 
schon besser jetzt bekomm ich zwar ne anzeige die mit dem roten kreuz aber das bringt mir nix. die grafik wird aber nicht angezeigt. außerdem haben sich meine anderen grafiken verschoben. (bannerwechsel ist in einem header eingearbeitet)

thx
 
hier der code in der banner.js (hab fürs posting die urls rausgelöscht. script funtzt so einwandfrei)

Script:

PHP:
<!--

banners = new Array();
banners[0] = "<img border='0' src='' height='60' width='468'>";
banners[1] = "<img border='0' src='' height='60' width='468'>";
banners[2] = "<img border='0' src='' height='60' width='468'>";
banners[3] = "<img border='0' src='' height='60' width='468'>";
banners[4] = "<img border='0' src='' height='60' width='468'>";
banners[5] = "<img border='0' src='' height='60' width='468'>";
banners[6] = "<img border='0' src='' height='60' width='468'>";
banners[7] = "<img border='0' src='' height='60' width='468'>";
banners[8] = "<img border='0' src='' height='60' width='468'>";
banners[9] = "<img border='0' src='' height='60' width='468'>";
banners[10] = "<img border='0' src='' height='60' width='468'>";
banners[11] = "<img border='0' src='' height='60' width='468'>";
banners[12] = "<img border='0' src='' height='60' width='468'>";
banners[13] = "<img border='0' src='' height='60' width='468'>";
banners[14] = "<img border='0' src='' height='60' width='468'>";
banners[15] = "<img border='0' src='' height='60' width='468'>";
banners[16] = "<img border='0' src='' height='60' width='468'>";
banners[17] = "<img border='0' src='' height='60' width='468'>";
banners[18] = "<img border='0' src='' height='60' width='468'>";
banners[19] = "<img border='0' src='' height='60' width='468'>";
banners[20] = "<img border='0' src='' height='60' width='468'>";

GoTo = new Array();
GoTo[0] = "";
GoTo[1] = "";
GoTo[2] = "";
GoTo[3] = "";
GoTo[4] = "";
GoTo[5] = "";
GoTo[6] = "";
GoTo[7] = "";
GoTo[8] = "";
GoTo[9] = "";
GoTo[10] = "";
GoTo[11] = "";
GoTo[12] = "";
GoTo[13] = "";
GoTo[14] = "";
GoTo[15] = "";
GoTo[16] = "";
GoTo[17] = "";
GoTo[18] = "";
GoTo[19] = "";
GoTo[20] = "";

var nr = Math.round(20 * Math.random());

var theLink = GoTo[nr];
var theImage = banners[nr];

document.write("<a href='" + theLink + "'>" + theImage + "</a>");

//-->


Aufruf:

PHP:
<script language="javascript" src="banner.js"></script>


danke
 
Achtung, das nachfolgende Script habe ich in meinen Unterlagen gefunden, es sollte so funktionieren:

PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>Untitled</title>
<SCRIPT language=JavaScript>


// Changeable variables

var totalBanners = 4		// Number of banners

bannerLocation = new Array;
bannerLink = new Array;
bannerHeight = new Array;
bannerWidth = new Array;
bannerAltText = new Array;
bannerDescription = new Array;
bannerDescriptionLink = new Array;
bannerTopEdge = new Array;
bannerLeftEdge = new Array;
showTime = new Array;

loadingMessage 				= "PLEASE WAIT WHILE LOADING BANNERS FOR BANNER ROTATEING"
errorMessage				= "SORRY, NO BANNERS LOADED"

bannerLocation[1] 			= "friggers.gif"
bannerLink[1] 				= "http://www.frigger.de"
bannerHeight[1] 			= 60
bannerWidth[1] 				= 468
bannerAltText[1] 			= "Witze, Humor und Spass im XXL-Format"
bannerDescription[1] 		= "Witze, Humor und Spass im XXL-Format"
bannerDescriptionLink[1] 	= "http://www.frigger.de"
bannerTopEdge[1] 			= 5
bannerLeftEdge[1] 			= 80
showTime[1]				    = 20000

bannerLocation[2] 			= "teenbanner.gif"
bannerLink[2] 				= "http://www.teenteen.de"
bannerHeight[2] 			= 60
bannerWidth[2] 				= 468
bannerAltText[2] 			= "Erotikseite mit Preiswertem Zugang"
bannerDescription[2] 		= "Erotikseite mit Preiswertem Zugang"
bannerDescriptionLink[2] 	= "http://www.teenteen.de"
bannerTopEdge[2] 			= 5
bannerLeftEdge[2] 			= 80
showTime[2]				    = 20000

bannerLocation[3] 			= "gunnarsb.gif"
bannerLink[3] 				= "http://home.t-online.de/home/gunnar.geissler/"
bannerHeight[3] 			= 60
bannerWidth[3] 				= 468
bannerAltText[3] 			= "Fussball und Formel 1 Infos"
bannerDescription[3] 		= "Fussball und Formel 1 Infos"
bannerDescriptionLink[3] 	= "http://home.t-online.de/home/gunnar.geissler/"
bannerTopEdge[3] 			= 5
bannerLeftEdge[3] 			= 80
showTime[3]					= 20000

bannerLocation[4] 			= "gameboerse.gif"
bannerLink[4] 				= "http://www.game-boerse.de"
bannerHeight[4] 			= 72
bannerWidth[4] 				= 432
bannerAltText[4] 			= "Spiele - ob neu oder gebraucht tauschen"
bannerDescription[4] 		= "Spiele - ob neu oder gebraucht tauschen"
bannerDescriptionLink[4] 	= "http://www.game-boerse.de"
bannerTopEdge[4] 			= 5
bannerLeftEdge[4] 			= 80
showTime[4]					= 20000

// Do not change these variables

var nobanners = 1;
var stopped = 0;
var bannerNowShowing = 0;
showTime[0] = 1000
var nextBanner = 1;
var layerRef="";
var styleSwitch="";
loaded=new Array;
for(var i=1; i<=totalBanners; i++){
	loaded[i] = 0
}


// start of the function section
// do not change anything here

function errorquestion(){
		if (bannerNowShowing == 0){
			hideLayer('LOADINGBANNER');
			showLayer('ERRORBANNER');
			stopped = 1
		}
}

function init(){
		if (navigator.appName == 'Netscape'){
		layerRef = 'document.layers';
		styleSwitch = '';
	}
	else{
		layerRef = 'document.all';
		styleSwitch = '.style';
	}
	rotateing();
}

function rotateing(){                                                               // rotates the gifs
    if (stopped == 0) {
		for(var j=nextBanner; j<=totalBanners; j++) {
			if (loaded[j] == 1) {
				nextBanner = j;
				showNextLayer();
				j = totalBanners + 2
			}
		}
		if (j == totalBanners + 1) {
			for(var j=1; j<bannerNowShowing; j++) {
				if (loaded[j] == 1) {
					nextBanner = j;
					showNextLayer();
					j = bannerNowShowing + 1
				}	
			}
		}
		window.setTimeout('rotateing()',showTime[bannerNowShowing]); 
	}
}


function showNextLayer(){
	if (bannerNowShowing == 0){
		hideLayer('LOADINGBANNER');
	}
	else {
		hideLayer(eval('"BANNER' + bannerNowShowing + '"'));
	}
	showLayer(eval('"BANNER' + nextBanner + '"'));
	bannerNowShowing = nextBanner;
	nextBanner = nextBanner + 1;
	if (nextBanner > totalBanners) {
		nextBanner = 1;
	}
}

function hideLayer(layerID){
	eval(layerRef + '["' + layerID + '"]' + styleSwitch + '.visibility="hidden"');
}

function showLayer(layerID){
	eval(layerRef + '["' + layerID + '"]' + styleSwitch + '.visibility="visible"');
}
//-->
</SCRIPT>

</head>

<body onload=errorquestion()>
<SCRIPT language=JavaScript>
<!--
document.write('<DIV ID="LOADINGBANNER" STYLE="position:absolute; left:'+bannerLeftEdge[1]+'px; top:'+bannerTopEdge[1]+'px; width:'+bannerWidth[1]+'px; height:'+bannerHeight[1]+'px; visibility:visible">');
document.write('<CENTER><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD ALIGN="CENTER" VALIGN="MIDDLE" WIDTH='+bannerWidth[1]+' HEIGHT='+bannerHeight[1]+'><I><FONT SIZE="2" FACE="Arial">'+loadingMessage+'</FONT></I></TD></TR></TABLE></CENTER>');
document.write('</DIV>');
document.write('<DIV ID="ERRORBANNER" STYLE="position:absolute; left:'+bannerLeftEdge[1]+'px; top:'+bannerTopEdge[1]+'px; width:'+bannerWidth[1]+'px; height:'+bannerHeight[1]+'px; visibility:hidden">');
document.write('<CENTER><TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR><TD ALIGN="CENTER" VALIGN="MIDDLE" WIDTH='+bannerWidth[1]+' HEIGHT='+bannerHeight[1]+'><I><FONT SIZE="2" FACE="Arial">'+errorMessage+'</FONT></I></TD></TR></TABLE></CENTER>');
document.write('</DIV>');

for(var k=1; k<=totalBanners; k++) {
	document.write('<DIV ID="BANNER'+k+'" STYLE="position:absolute; left:'+bannerLeftEdge[k]+'px; top:'+bannerTopEdge[k]+'px; width:'+bannerWidth[k]+'px; height:'+bannerHeight[k]+'px; visibility:hidden">');
	document.write('<A HREF="'+bannerLink[k]+'" TARGET="_top"><IMG onLoad="loaded['+k+']=1" SRC="'+bannerLocation[k]+'" BORDER=0 WIDTH='+bannerWidth[k]+' HEIGHT='+bannerHeight[k]+' ALT="'+bannerAltText[k]+'"></A>');
	document.write('<BR><CENTER><FONT FACE="Arial" SIZE="1"><A HREF="'+bannerDescriptionLink[k]+'" TARGET="_top">'+bannerDescription[k]+'</A></FONT></CENTER>');
	document.write('</DIV>');
}
init();
//-->
</SCRIPT>


</body>
</html>
 
hi 3DMaxler,

habe dein Script getestet und es funktioniert einwandfrei.


url´s für posting gelöscht!
hast du auch die img source vorher gefüllt gehabt?
macht sinn ;)

gruss timmy



BTW* das script von Thomas L. ist super.
 

Neue Beiträge

Zurück