30. november 2001 - 13:41
Der er
1 kommentar og 1 løsning
Drop down menu NS/IE
Hej! Hvordan helvede laver man dette javascript så det fungere i Netscape\'s lorte browser? <script javascript> function show(){ A1.style.display = \"block\" } </script> ... <html> .. <div id=A1 style=\"display:none\"> hej med dig, din røver </div> ... <img onMouseOver=\"show();\"></img> </html> Hvor kan man se en sammenligning over hvad som virker i henholdsvis IE og NS?? hilsen floffer-jøbbe
Annonceindlæg fra Infor
30. november 2001 - 13:44
#1
IE5: document.all og document.getElementById NS4.x: document.layers NS6/IE6: document.getElementById prøv denne: <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"> <html> <STYLE TYPE=\"text/css\"> #divOne {position:absolute;left:100px;top:125px;visibility:hidden;clip:rect(0,125,25,0); background-color:#ffffff; layer-background-color:#ffffff;} #divTwo {position:absolute;left:120px;top:150px;visibility:hidden;clip:rect(0,125,25,0); background-color:#ffffff; layer-background-color:#ffffff;} #divThree {position:absolute;left:130px;top:175px;visibility:hidden;clip:rect(0,125,25,0); background-color:#ffffff; layer-background-color:#ffffff;} #divFour {position:absolute;left:140px;top:200px;visibility:hidden;clip:rect(0,125,25,0); background-color:#ffffff; layer-background-color:#ffffff;} </STYLE> <SCRIPT LANGUAGE=\"JavaScript\" TYPE=\"text/javascript\"> <!-- var ns, ns6, ie; ns = (document.layers) ? true : false; ns6 = (document.getElementById) ? true : false; ie = (document.all) ? true : false; function showLayer( layer ){ if( ns ){ document.layers[layer].visibility = \"visible\"; } else if( ie ){ document.all[ layer ].style.visibility = \"visible\"; } else if( ns6 ){ document.getElementById(layer).style.visibility = \"visible\"; } } function hideLayer( layer ){ if( ns ){ document.layers[layer].visibility = \"hidden\"; } else if( ie ){ document.all[ layer ].style.visibility = \"hidden\"; } else if( ns6 ){ document.getElementById(layer).style.visibility = \"hidden\"; } } //--> </SCRIPT> <body> <a href=\"java script:void(null);\" onMouseOver=\"showLayer(\'divOne\');\" onMouseOut=\"hideLayer(\'divOne\');\">Show/hide \'divOne\'</a> <a href=\"java script:void(null);\" onMouseOver=\"showLayer(\'divTwo\');\" onMouseOut=\"hideLayer(\'divTwo\');\">Show/hide \'divTwo\'</a> <a href=\"java script:void(null);\" onMouseOver=\"showLayer(\'divThree\');\" onMouseOut=\"hideLayer(\'divThree\');\">Show/hide \'divThree\'</a> <a href=\"java script:void(null);\" onMouseOver=\"showLayer(\'divFour\');\" onMouseOut=\"hideLayer(\'divFour\');\">Show/hide \'divFour\'</a> <div name=\"divOne\" id=\"divOne\">Insett din tekst her</div> <div name=\"divTwo\" id=\"divTwo\">Insett din tekst her</div> <div name=\"divThree\" id=\"divThree\">Insett din tekst her</div> <div name=\"divFour\" id=\"divFour\">Insett din tekst her</div> </body> </html> /nute