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.
Ich würde mich sehr freuen, wenn mir jemand beim Umstricken des Sciptes helfen könnte.
Gruß stupet4
Hier ist das Script:
<script language="javascript">
<!--
// Bilder Preload
toppbg = new Image();
toppbg.src = "images/toppbg.gif"
// Browser detection
ns = (document.layers) ? true:false
ie = (document.all) ? true:false
// Set global variables
var showing = "web";
var comingup;
var sliding = false;
var dest = 30;
// Preload images / Create image objects
m_web0 = new Image();
m_web0.src = "images/m_web_0.gif";
m_web1 = new Image();
m_web1.src = "images/m_web_1.gif";
m_web2 = new Image();
m_web2.src = "images/m_web_2.gif";
m_print0 = new Image();
m_print0.src = "images/m_print_0.gif";
m_print1 = new Image();
m_print1.src = "images/m_print_1.gif";
m_print2 = new Image();
m_print2.src = "images/m_print_2.gif";
m_andere0 = new Image();
m_andere0.src = "images/m_andere_0.gif";
m_andere1 = new Image();
m_andere1.src = "images/m_andere_1.gif";
m_andere2 = new Image();
m_andere2.src = "images/m_andere_2.gif";
// Document initialization
function init() {
if (ns) {
webB = document.layers["webDiv"];
printB = document.layers["printDiv"];
andereB = document.layers["andereDiv"];
}
if (ie) {
webB = document.all["webDiv"].style;
printB = document.all["printDiv"].style;
andereB = document.all["andereDiv"].style;
}
webB.ypos = parseInt(webB.top);
printB.ypos = parseInt(printB.top);
andereB.ypos = parseInt(andereB.top);
printB.ypos = (ie) ? 0-document.all["printDiv"].offsetHeight : 0-printB.document.height;
andereB.ypos = (ie) ? 0-document.all["andereDiv"].offsetHeight : 0-andereB.document.height;
printB.top = printB.ypos;
andereB.top = andereB.ypos;
showLayer("topDiv"
showLayer("striperDiv"
showLayer("printDiv"
showLayer("andereDiv"
showLayer("menyDiv"
showLayer("webDiv"
}
function showLayer(name) {
if (ns) document.layers[name].visibility = "show";
if (ie) document.all[name].style.visibility = "visible";
}
function hideLayer(name) {
if (ns) document.layers[name].visibility = "hide";
if (ie) document.all[name].style.visibility = "hidden";
}
// Slide in content layer
function slideIn(arg) {
if (arg) {
block2 = eval(comingup + "B"
}
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("slideIn()",10);
}
else if (block2.ypos == dest) {
sliding = false;
}
}
// Slide out currently showing layer
function slideOut(arg) {
if (arg) {
block1 = eval(showing + "B"
endpos = (ie) ? 0-document.all[showing + "Div"].offsetHeight : 240-document.layers[showing + "Div"].document.height;
}
if (block1.ypos > endpos) {
block1.ypos -= 8;
block1.top = block1.ypos;
setTimeout("slideOut()",10);
}
else if (block1.ypos < endpos) {
block1.ypos = endpos;
block1.top = block1.ypos;
setTimeout("slideOut()",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 + "Img"].src = eval("m_" + showing + "0.src"
if (ie) document[showing + "Img"].src = eval("m_" + showing + "0.src"
if (ns) document.menyDiv.document[navn + "Img"].src = eval("m_" + navn + "2.src"
if (ie) document[navn + "Img"].src = eval("m_" + navn + "2.src"
showing = navn;
}
}
// Menu rollovers
function m_on(navn) {
if (navn != showing) {
if (ns) document.menyDiv.document[navn + "Img"].src = eval("m_" + navn + "1.src"
if (ie) document[navn + "Img"].src = eval("m_" + navn + "1.src"
}
}
function m_off(navn) {
if (navn != showing) {
if (ns) document.menyDiv.document[navn + "Img"].src = eval("m_" + navn + "0.src"
if (ie) document[navn + "Img"].src = eval("m_" + navn + "0.src"
}
}
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 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.
Ich würde mich sehr freuen, wenn mir jemand beim Umstricken des Sciptes helfen könnte.
Gruß stupet4
Hier ist das Script:
<script language="javascript">
<!--
// Bilder Preload
toppbg = new Image();
toppbg.src = "images/toppbg.gif"
// Browser detection
ns = (document.layers) ? true:false
ie = (document.all) ? true:false
// Set global variables
var showing = "web";
var comingup;
var sliding = false;
var dest = 30;
// Preload images / Create image objects
m_web0 = new Image();
m_web0.src = "images/m_web_0.gif";
m_web1 = new Image();
m_web1.src = "images/m_web_1.gif";
m_web2 = new Image();
m_web2.src = "images/m_web_2.gif";
m_print0 = new Image();
m_print0.src = "images/m_print_0.gif";
m_print1 = new Image();
m_print1.src = "images/m_print_1.gif";
m_print2 = new Image();
m_print2.src = "images/m_print_2.gif";
m_andere0 = new Image();
m_andere0.src = "images/m_andere_0.gif";
m_andere1 = new Image();
m_andere1.src = "images/m_andere_1.gif";
m_andere2 = new Image();
m_andere2.src = "images/m_andere_2.gif";
// Document initialization
function init() {
if (ns) {
webB = document.layers["webDiv"];
printB = document.layers["printDiv"];
andereB = document.layers["andereDiv"];
}
if (ie) {
webB = document.all["webDiv"].style;
printB = document.all["printDiv"].style;
andereB = document.all["andereDiv"].style;
}
webB.ypos = parseInt(webB.top);
printB.ypos = parseInt(printB.top);
andereB.ypos = parseInt(andereB.top);
printB.ypos = (ie) ? 0-document.all["printDiv"].offsetHeight : 0-printB.document.height;
andereB.ypos = (ie) ? 0-document.all["andereDiv"].offsetHeight : 0-andereB.document.height;
printB.top = printB.ypos;
andereB.top = andereB.ypos;
showLayer("topDiv"
showLayer("striperDiv"
showLayer("printDiv"
showLayer("andereDiv"
showLayer("menyDiv"
showLayer("webDiv"
}
function showLayer(name) {
if (ns) document.layers[name].visibility = "show";
if (ie) document.all[name].style.visibility = "visible";
}
function hideLayer(name) {
if (ns) document.layers[name].visibility = "hide";
if (ie) document.all[name].style.visibility = "hidden";
}
// Slide in content layer
function slideIn(arg) {
if (arg) {
block2 = eval(comingup + "B"
}
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("slideIn()",10);
}
else if (block2.ypos == dest) {
sliding = false;
}
}
// Slide out currently showing layer
function slideOut(arg) {
if (arg) {
block1 = eval(showing + "B"
endpos = (ie) ? 0-document.all[showing + "Div"].offsetHeight : 240-document.layers[showing + "Div"].document.height;
}
if (block1.ypos > endpos) {
block1.ypos -= 8;
block1.top = block1.ypos;
setTimeout("slideOut()",10);
}
else if (block1.ypos < endpos) {
block1.ypos = endpos;
block1.top = block1.ypos;
setTimeout("slideOut()",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 + "Img"].src = eval("m_" + showing + "0.src"
if (ie) document[showing + "Img"].src = eval("m_" + showing + "0.src"
if (ns) document.menyDiv.document[navn + "Img"].src = eval("m_" + navn + "2.src"
if (ie) document[navn + "Img"].src = eval("m_" + navn + "2.src"
showing = navn;
}
}
// Menu rollovers
function m_on(navn) {
if (navn != showing) {
if (ns) document.menyDiv.document[navn + "Img"].src = eval("m_" + navn + "1.src"
if (ie) document[navn + "Img"].src = eval("m_" + navn + "1.src"
}
}
function m_off(navn) {
if (navn != showing) {
if (ns) document.menyDiv.document[navn + "Img"].src = eval("m_" + navn + "0.src"
if (ie) document[navn + "Img"].src = eval("m_" + navn + "0.src"
}
}
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>