dthnam90 Thành viên gắn bó lâu dài
Tổng số bài gửi : 137 Join date : 04/01/2011
| Tiêu đề: Thay đổi màu nền của button bằng sự kiện onmouseover Fri Jan 21, 2011 10:25 pm | |
| Thay đổi màu nền của button bằng sự kiện onmouseoverCác bạn xem đoạn code này nghe: - Code:
-
<html> <head> <script type="text/javascript"> function changeColor(color) { document.getElementById('x').style.background=color; } </script> </head>
<body>
<p>This example demonstrates how to change the background color of a button.</p> <p>Mouse over the three colored table cells, and the background color will change:</p>
<table width="100%"><tr> <td bgcolor="red" onmouseover="changeColor('red')"> </td> <td bgcolor="blue" onmouseover="changeColor('blue')"> </td> <td bgcolor="green" onmouseover="changeColor('green')"> </td> </tr></table>
<form> <input id="x" type="button" value="Mouse over the colors"> </form>
</body> </html>
| |
|