ด้วยการเปลี่ยนรูปแบบการแสดงผลของปุ่มการปัดปุ่มแบบไดนามิกจะทำได้
การคัดลอกรหัสมีดังนี้:
<! 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">
<head>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" />
<tite> เอกสารชื่อ UNT </title>
</head>
<style>
.Search {พื้นหลัง:#008800; สี: #FFF; ชายแดน: ไม่มี; ความสูง: 26px; ความสูงของสาย: 20px; ความกว้าง: 63x;}
.SearchHover {พื้นหลัง:#000099; สี: #FFF; ชายแดน: ไม่มี; ความสูง: 26px; ความสูงของสาย: 20px; ความกว้าง: 63px; -
</style>
</head>
<body onload = "js ()">
<อินพุต type = "ปุ่ม" id = "btn" name = "btn" value = "เข้าสู่ระบบ"/>
<อินพุต type = "ปุ่ม" id = "btn2" name = "btn" value = "logout"/>
<script type = "text/javascript">
ฟังก์ชั่น js ()
-
// ทำให้ปุ่ม IE6 รองรับแอตทริบิวต์โฮเวอร์ obj เอนทิตีที่ต้องการรองรับโฮเวอร์คือรูปแบบของ BTN: โฮเวอร์และ init เป็นสไตล์เริ่มต้น
obj = "btn";
การแจ้งเตือน (Navigator.Appname);
if (navigator.appname == "Microsoft Internet Explorer" && parsefloat (Navigator.Appversion) == 4) {// การตัดสิน IE6
var o = document.getElementsByName (OBJ);
สำหรับ (var i = 0; i <o.length; i ++) {
ถ้า (o [i] .type == "ปุ่ม") {
//o [outhi like.classname = "search";
o [i] .onMouseOver = function () {this.className = "SearchHover"}
o [i] .onMouseOut = function () {this.className = "search"};
-
-
-
-
</script>
</body>
</html>