参考:http://www.fgm.cc/learn/lesson2/01.html
代码:
<script type="text/javascript">
window.onload = function() {
var but = document.getElementsByTagName("button")[0];
var li = document.getElementsByTagName("li");
var ime = document.getElementById("ime");
var cls = document.getElementById("close");
but.onclick = function() {
// alert(ime.style.display);
ime.style.display = ime.style.display == "block" ? "none" : "block"
};
cls.onclick = function() {
ime.style.display = "none"
};
cls.onmouseover = function() {
cls.style.background = "gray"
}
cls.onmouseout = function() {
cls.style.background = "white"
}
}
</script>