Léa-Linux & amis :   LinuxFR   GCU-Squad   GNU
java script et compatibilité
Envoyé par: miky

bonjour à tous j ai besoin de votre aide , j ai reffait le site de la pme de mon père et j ai mi un menu latéral escamotable au survol de la souris (en java script) mais j ai un énorme probleme ce script ne marche qu avec internet explorer !!!!! :,( ( c est un mahleur ! ):,( même sous firefox , mozilla, konqueror le script ne marche pas . pouvez vous m aidez ? je vous donne le sript:
dans le head :



<script language="JavaScript1.2">

function move(x) {
if (document.all) {
object1.style.pixelLeft += x;
object1.style.visibility = "visible"}
else if (document.layers) {
document.object1.left += x;
document.object1.visibility = "show"}};


var fromtop=40

function makeStatic() {
if (document.all) {object1.style.pixelTop=document.body.scrollTop+fromtop}
else {eval(document.object1.top=eval(window.pageYOffset+fromtop));}
setTimeout("makeStatic()",0);}
</script>

<style>
<!--
.nounderline {
text-decoration:none
}
.hl {
background-Color : yellow;
cursor:hand;
}
.n {
cursor:hand;
}
-->
</style>



dans la balise body :


<LAYER visibility="hide" top="20" name="object1" bgcolor="black" left="0" onmouseover="move(214)" onmouseout="move(-214)">

<script language="JavaScript1.2">
function positionmenu(){
move(-214)
}
if (document.all) {document.write('<DIV ID="object1" style="visibility:hidden;cursor:hand; Position : Absolute ;Left : 0px ;Top : 10px ;Z-Index : 20" onmouseover="move(214)" onmouseout="move(-214)">')}
</script>

<table border="0" cellpadding="0" cellspacing="1" width="230" bgcolor="#000000">
<tr><td bgcolor="#0099FF"> <font size="3" face="Arial"><b>Menu</b></font></td>

<script language="JavaScript1.2">
document.write('<td align="center" rowspan="214" width="16" bgcolor="#FF6666"><span style="font-size:11px"><p align="center"><font face="Arial"><B>C<br>o<br>n<br>t<br>e<br>n<BR>u<BR> <BR>d<BR>u<BR> <BR>s<BR>i<BR>t<BR>e</B></font></p></span></TD>')
</script>

</tr>

<script language="JavaScript1.2"><!--
if (document.all||document.layers) {
makeStatic();}

var text=new Array();
var thelink=new Array();



text[0]="le restaurant";
text[1]="la carte";
text[2]="visite ";
text[3]="plan d acces";
text[4]="reservation";
text[5]="autre";
text[6]="autre";
text[7]="autre";
text[8]="autre";
text[9]="autre";
text[10]="autre";


thelink[0]=".html";
thelink[1]=".htm";
thelink[2]=".htm";
thelink[3]=".htm";
thelink[4]=".htm";
thelink[5]=".htm";
thelink[6]=".htm";
thelink[7]=".htm";
thelink[8]=".htm";
thelink[9]=".html";
thelink[10]=".htm";







function navigateie(which){
if (linktarget=='')
window.location=thelink[which]
else if (linktarget=='new')
window.open(thelink[which])
else{
temp_var=eval("window.parent."+linktarget)
temp_var.location=thelink[which]
}
}

for (i=0;i<=text.length-1;i++)
if (document.all) {document.write('<TR><TD height=20 bgcolor=white onclick="navigateie('+i+')" onmouseover="className=\'hl\'" onmouseout="className=\'n\'"><FONT SIZE=2 FACE=ARIAL>&nbsp;'+text+'</FONT></TD></TR>')}
else {document.write('<TR><TD bgcolor="white"><ILAYER><LAYER HEIGHT="18" onmouseover="this.bgColor=\'yellow\'" onmouseout="this.bgColor=\'white\'" width=131><FONT SIZE=2 FACE=ARIAL>&nbsp;<A HREF="'+thelink+'" target="'+linktarget+'">'+text+'</A></FONT></LAYER></ILAYER></TD></TR>')}

//-->
</script>
<tr>
<td bgcolor="#0099FF"><font size="1" face="Arial"> </font></td>
</TR>
</table>
<script language="JavaScript1.2">
if (document.all) {document.write('</DIV>')}
window.onload=positionmenu
</script>
</LAYER>



dois je modifier le script pour qu il soit "lu" corectement par les autres browsers ? merci de m aider ; à bientot

Poste le Friday 29 April 2005 20:06:24
Répondre     Citer    
Re: java script et compatibilité
Envoyé par: duff

Je suis désolé, mais je ne vais pas corriger ton code, tu utilises trop de code spécifique aux différents navigateurs, plutôt que d'utiliser les standards (je sais, ce n'est pas ce qu'on trouve dès la première recherche malheureusement)

Je te propose plutôt des sites qui donnent le code de menus en utilisant les standards et qui marchent sur IE et Mozilla, Firefox....

[www.ibilab.net]
[css.alsacreations.com]

J'espère que ça t'aidera à refaire ton site.

Poste le Monday 2 May 2005 18:36:48
Répondre     Citer    

Veuillez vous authentifier auparavant pour commenter.

 

Ce forum !
java script et compatibilité
Pour poser vos questions sur les scripts shell, le Perl, le C, etc... Attention : nous ne sommes pas des spécialistes du dev, ce forum est juste pour de petites aides ponctuelles concernant le développement et les outils de développement.

Sauf mention contraire, les documentations publiées sont sous licence Creative-Commons