Script pour souris

Bonjour,

J'ai un script pour souris :

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans nom</title>
<STYLE type="text/css" id="style1">
<!--
a:link {
color: #996666;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #990000;
}
a:hover {
text-decoration: none;
color:#00CCCC
}
a:active {
text-decoration: none;
color:#CCCCFF
}
</STYLE>

<STYLE id="style2" >
<!--
a:link {
color: #0000FF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color:#6633FF
}
a:hover {
text-decoration: none;
color:#FFFFFF
}
a:active {
text-decoration: none;
color:#99CC00
}
</STYLE>
</head>

<body>
<script language="javascript" type="text/javascript">
function bouton(e) {
if (navigator.appName == 'Microsoft Internet Explorer'){
if (event.button==1){getelementbyid("style1");}
else if (event.button==2){getelementbyid("style2");}

}
if (navigator.appName == 'Netscape'){
if (e.which==1){getelementbyid("style1");}
else if (e.which==3){getelementbyid("style2");}
}
}
window.onmousedown=bouton;
document.onmousedown=bouton;
document.captureEvents(Event.MOUSEDOWN);
</script>
<a href=http://www.tonsite.com onmousedown()='bouton'>hello</a>
</body>

Ou dois-je le mettre ?

Merci de vos réponse

Cordialement,
Configuration: Windows XP
Firefox 3.0.12

15 réponses

  • Votes
  • Date
  • Date décroissante
  1. il faut mètre sa entre les balise <head> de ton site :<STYLE type="text/css" id="style1">
    <!--
    a:link {
    color: #996666;
    text-decoration: none;
    }
    a:visited {
    text-decoration: none;
    color: #990000;
    }
    a:hover {
    text-decoration: none;
    color:#00CCCC
    }
    a:active {
    text-decoration: none;
    color:#CCCCFF
    }
    </STYLE>

    <STYLE id="style2" >
    <!--
    a:link {
    color: #0000FF;
    text-decoration: none;
    }
    a:visited {
    text-decoration: none;
    color:#6633FF
    }
    a:hover {
    text-decoration: none;
    color:#FFFFFF
    }
    a:active {
    text-decoration: none;
    color:#99CC00
    }
    </STYLE>


    Et sa entre les balise <body>
    <script language="javascript" type="text/javascript">
    function bouton(e) {
    if (navigator.appName == 'Microsoft Internet Explorer'){
    if (event.button==1){getelementbyid("style1");}
    else if (event.button==2){getelementbyid("style2");}
    
    }
    if (navigator.appName == 'Netscape'){
    if (e.which==1){getelementbyid("style1");}
    else if (e.which==3){getelementbyid("style2");}
    }
    }
    window.onmousedown=bouton;
    document.onmousedown=bouton;
    document.captureEvents(Event.MOUSEDOWN);
    </script>
    <a href=http://www.tonsite.com onmousedown()='bouton'>hello</a> 


    comme sait fait mais si tu copie et colle directement tous ton code dans ton site il risque di avoir des problème ^^
    1. Donne plus d'information ( si c'est un site codé a la main ou un site du genre e-monsite.com ) s'il te plais
      1. Va voir sa tu comprendra mieu : http://www.bachosdesign.com/fr/enseignement/programmation/html.php

        1. Je ne comprend rien -_-' a vrai dire l'informatique et moi sa fait 2 -_-'

          ajoute msn pour qu'on parle ça te dérange pas ?

          Mon msn : arsenic_du_59@hotmail.fr

          merci de consacré du temps for me ;)

          ++
          1. Plus simple que de me donné ton msn ( et évité les spam xD )

            envoi le code source de ta page ;)
            1. Haaa oui d'acord :)

              Déja tu a du un peut te trompé de ''partit'' ici c'est webmastering pas windows ^^

              Et pour ton curseur de sourit le code c'est pour les sites web pas pour windows ^^

              Pour faire plus simple ,,, tu peut pas mètre ton curseur sur ton pc :)