Tag
Das Problem scheinen die Anführungszeichen gewesen zu sein, sowohl bei den Größenangaben als auch bei der Ausgabe (falsche Verschachtelung).
Jetzt geht's (zumindet mit IE5 und NC4):
-------------------------------------------------
// Zahl der Bilder hier konfigurieren
var picCount = 5;
// Standard-alt-Text hier konfigurieren
var defaultText = 'INCONTRI - Ristorante Italiano';
randPic = new Array();
picWidth = new Array();
picHeight = new Array();
picTxt = new Array();
altTxt = new Array();
// Array mit Bildnamen hier konfigurieren
randPic[0] = 'restaurant2.jpg';
picWidth[0] = 240;
picHeight[0] = 160;
picTxt[0] = 'Ristorante';
randPic[1] = 'nudelgabel.gif';
picWidth[1] = 120;
picHeight[1] = 180;
picTxt[1] = 'Maccaroni & Gabel';
randPic[2] = 'bar1.jpg';
picWidth[2] = 180;
picHeight[2] = 120;
picTxt[2] = 'Bar';
randPic[3] = 'osteria.jpg';
picWidth[3] = 180;
picHeight[3] = 120;
picTxt[3] = 'C. Bloch, In un osteria romana, 1860';
randPic[4] = 'gabel.jpg';
picWidth[4] = 180;
picHeight[4] = 120;
picTxt[4] = 'Olive & Gabel';
// ---------- Ab hier nichts mehr verändern! ----------
// Standard-alt-Text
for (i = 0; i < picCount; i++)
{
if ((picTxt[i] == '') || (picTxt[i] == 'undefined')) altTxt[i] = defaultText;
else altTxt[i] = picTxt[i];
}
// Zufallsfunktion
var num = Math.round((picCount - 1) * Math.random());
// Ausgabe des HTML-Quelltextes
function ranPic()
{
var str = "<a href="index.htm" onMouseOver="window.status='';return true;" onMouseOut="window.status='';return true;"><img src="./img/" + randPic[num] + "" width="" + picWidth[num] + "" height="" + picHeight[num] + "" border="0" alt="" + altTxt[num] + ""></a>";
document.write(str);
alert(str); // test
}
ranPic();
-------------------------
Ciao,
Harry