Problem mit Javascript in Firefox

stupet4

Grünschnabel
Hallo,
... ich habe ein Problem mit meinem Javascript und der Anzeige in Firefox.
In allen andereren gängigen Browsern funktioniert es, nur dort nicht.
Ich nehme an das es mit "document.all" zusammenhängt, alles rumprobieren führte aber leider zu keinem positiven Ergebnis.
cry.gif


Ich würde mich sehr freuen, wenn mir jemand beim Umstricken des Sciptes helfen könnte.

Gruß stupet4
huh.gif


Hier ist das Script:


<script language=&quot;javascript&quot;>
<!--

// Bilder Preload

toppbg = new Image();
toppbg.src = &quot;images/toppbg.gif&quot;


// Browser detection

ns = (document.layers) ? true:false
ie = (document.all) ? true:false


// Set global variables

var showing = &quot;web&quot;;
var comingup;
var sliding = false;
var dest = 30;


// Preload images / Create image objects

m_web0 = new Image();
m_web0.src = &quot;images/m_web_0.gif&quot;;
m_web1 = new Image();
m_web1.src = &quot;images/m_web_1.gif&quot;;
m_web2 = new Image();
m_web2.src = &quot;images/m_web_2.gif&quot;;

m_print0 = new Image();
m_print0.src = &quot;images/m_print_0.gif&quot;;
m_print1 = new Image();
m_print1.src = &quot;images/m_print_1.gif&quot;;
m_print2 = new Image();
m_print2.src = &quot;images/m_print_2.gif&quot;;

m_andere0 = new Image();
m_andere0.src = &quot;images/m_andere_0.gif&quot;;
m_andere1 = new Image();
m_andere1.src = &quot;images/m_andere_1.gif&quot;;
m_andere2 = new Image();
m_andere2.src = &quot;images/m_andere_2.gif&quot;;

// Document initialization

function init() {
if (ns) {
webB = document.layers[&quot;webDiv&quot;];
printB = document.layers[&quot;printDiv&quot;];
andereB = document.layers[&quot;andereDiv&quot;];
}
if (ie) {
webB = document.all[&quot;webDiv&quot;].style;
printB = document.all[&quot;printDiv&quot;].style;
andereB = document.all[&quot;andereDiv&quot;].style;
}
webB.ypos = parseInt(webB.top);
printB.ypos = parseInt(printB.top);
andereB.ypos = parseInt(andereB.top);
printB.ypos = (ie) ? 0-document.all[&quot;printDiv&quot;].offsetHeight : 0-printB.document.height;
andereB.ypos = (ie) ? 0-document.all[&quot;andereDiv&quot;].offsetHeight : 0-andereB.document.height;
printB.top = printB.ypos;
andereB.top = andereB.ypos;
showLayer(&quot;topDiv&quot;);
showLayer(&quot;striperDiv&quot;);
showLayer(&quot;printDiv&quot;);
showLayer(&quot;andereDiv&quot;);
showLayer(&quot;menyDiv&quot;);
showLayer(&quot;webDiv&quot;);
}

function showLayer(name) {
if (ns) document.layers[name].visibility = &quot;show&quot;;
if (ie) document.all[name].style.visibility = &quot;visible&quot;;
}

function hideLayer(name) {
if (ns) document.layers[name].visibility = &quot;hide&quot;;
if (ie) document.all[name].style.visibility = &quot;hidden&quot;;
}


// Slide in content layer

function slideIn(arg) {
if (arg) {
block2 = eval(comingup + &quot;B&quot;);
}
if (block2.ypos <= (dest - 25)) {
block2.ypos += 8;
block2.top = block2.ypos;
}
else if ((block2.ypos > (dest - 25)) && (block2.ypos <= (dest - 12))) {
block2.ypos += 3;
block2.top = block2.ypos;
}
else if ((block2.ypos > (dest - 12)) && (block2.ypos <= (dest - 4))) {
block2.ypos += 2;
block2.top = block2.ypos;
}
else if ((block2.ypos > (dest - 4)) && (block2.ypos <= (dest - 1))) {
block2.ypos += 1;
block2.top = block2.ypos;
}
if (block2.ypos > dest) {
block2.ypos = dest;
block2.top = block2.ypos;
}
else if (block2.ypos < dest) {
setTimeout(&quot;slideIn()&quot;,10);
}
else if (block2.ypos == dest) {
sliding = false;
}
}


// Slide out currently showing layer

function slideOut(arg) {
if (arg) {
block1 = eval(showing + &quot;B&quot;);
endpos = (ie) ? 0-document.all[showing + &quot;Div&quot;].offsetHeight : 240-document.layers[showing + &quot;Div&quot;].document.height;
}
if (block1.ypos > endpos) {
block1.ypos -= 8;
block1.top = block1.ypos;
setTimeout(&quot;slideOut()&quot;,10);
}
else if (block1.ypos < endpos) {
block1.ypos = endpos;
block1.top = block1.ypos;
setTimeout(&quot;slideOut()&quot;,10);
}
else if (block1.ypos == endpos) {
slideIn(1);
}
}


// Set it off

function hokuspokus(navn) {
if ((navn != showing) && !sliding) {
sliding = true;
comingup = navn;
slideOut(1);
if (ns) document.menyDiv.document[showing + &quot;Img&quot;].src = eval(&quot;m_&quot; + showing + &quot;0.src&quot;);
if (ie) document[showing + &quot;Img&quot;].src = eval(&quot;m_&quot; + showing + &quot;0.src&quot;);
if (ns) document.menyDiv.document[navn + &quot;Img&quot;].src = eval(&quot;m_&quot; + navn + &quot;2.src&quot;);
if (ie) document[navn + &quot;Img&quot;].src = eval(&quot;m_&quot; + navn + &quot;2.src&quot;);
showing = navn;
}
}


// Menu rollovers

function m_on(navn) {
if (navn != showing) {
if (ns) document.menyDiv.document[navn + &quot;Img&quot;].src = eval(&quot;m_&quot; + navn + &quot;1.src&quot;);
if (ie) document[navn + &quot;Img&quot;].src = eval(&quot;m_&quot; + navn + &quot;1.src&quot;);
}
}

function m_off(navn) {
if (navn != showing) {
if (ns) document.menyDiv.document[navn + &quot;Img&quot;].src = eval(&quot;m_&quot; + navn + &quot;0.src&quot;);
if (ie) document[navn + &quot;Img&quot;].src = eval(&quot;m_&quot; + navn + &quot;0.src&quot;);
}
}
function openWindow(theURL,winName,features) {
var inhalt = window.open(theURL,winName,features);
if(inhalt.closed != true) // wenn das Fenster schon geöffnet ist
{
inhalt.focus();
}
}

//-->
</script>
 
Ich weiss nicht, was du unter "gängigen Browsern" verstehst... dieses Skript wurde geschrieben für Netscape4 und IE4.
Neuere IE-Versionen können das sicher auch... Opera vielleicht auch...dann ist Schluss.

Dieses Skript ist uralt... wenn du es an die heutigen Gegebenheiten anpassen willst, verwende die Möglichkeiten des DOM
 

Neue Beiträge

Zurück