En modifiant le style d'affichage du bouton, le balayage du bouton dynamique est réalisé
La copie de code est la suivante:
<! Doctype html public "- // w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<adal>
<meta http-equiv = "contenu-type" contenu = "text / html; charset = utf-8" />
<Title> UNT intitulé Document </Title>
</ head>
<style>
.Search {Background: # 008800; Couleur: #FFF; Border: aucun; hauteur: 26px; hauteur de ligne: 20px; Largeur: 63x;}
.SearchHover {Background: # 000099; Couleur: #FFF; Border: aucun; hauteur: 26px; hauteur de ligne: 20px; Largeur: 63px; }
</ style>
</ head>
<body onload = "js ()">
<input type = "Button" id = "btn" name = "btn" value = "login" />
<input type = "Button" id = "btn2" name = "btn" value = "logout" />
<script type = "text / javascript">
fonction js ()
{
// Faire l'attribut de support de bouton IE6
obj = "btn";
alert (Navigator.AppName);
if (Navigator.appname == "Microsoft Internet Explorer" && parsefloat (Navigator.Appversion) == 4) {// Jugement IE6
var o = document.getElementsByName (obj);
pour (var i = 0; i <o.length; i ++) {
if (o [i] .type == "bouton") {
//o[i
o [i] .onMouseOver = function () {this.classname = "searchhover"}
o [i] .onMouseout = function () {this.classname = "search"};
}
}
}
}
</cript>
</docy>
</html>