عن طريق تغيير نمط العرض للزر ، يتم تحقيق تمرير الأزرار الديناميكية
نسخة الكود كما يلي:
<! doctype html public "-// w3c // dtd xhtml 1.0 transitional // en"
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-type" content = "text /html ؛ charset = utf-8" />
<title> Unted Document </title>
</head>
<style>
.Search {background:#008800 ؛ اللون: #fff ؛ الحدود: لا شيء ؛ الارتفاع: 26 بكسل ؛ رفع الخط: 20 بكسل ؛ العرض: 63x ؛}
.SearchHover {Background:#000099 ؛ اللون: #fff ؛ الحدود: لا شيء ؛ الارتفاع: 26 بكسل ؛ رفع الخط: 20 بكسل ؛ العرض: 63px ؛ }
</style>
</head>
<body onload = "js ()">
<type type = "button" id = "btn" name = "btn" value = "login"/>
<type type = "button" id = "btn2" name = "btn" value = "logout"/>
<script type = "text/javaScript">
وظيفة JS ()
{
.
obj = "btn" ؛
تنبيه (navigator.appname) ؛
if (navigator.appname == "Microsoft Internet Explorer" && parsefloat (navigator.appversion) == 4) {// justice ie6
var o = document.getElementSbyName (OBJ) ؛
لـ (var i = 0 ؛ i <o.length ؛ i ++) {
if (o [i] .type == "button") {
//o budapi.
o [i] .onmouseover = function () {this.className = "SearchHover"}
o [i] .onmouseout = function () {this.className = "Search"} ؛
}
}
}
}
</script>
</body>
</html>