for (var x = 1; x < 6; x++) { var menuid = document.getElementById("menu" + x); menuid.num = x; type(); } function type() { var menuh2 = menuid.getElementsByTagName("h2"); var menuul = menuid.getElementsByTagName("ul"); var menuli = menuul[0].getElementsByTagName("li"); menuh2[0].onmouseover = show; menuh2[0].onmouseout = unshow; menuul[0].onmouseover = show; menuul[0].onmouseout = unshow; function show() { menuul[0].className = "clearfix typeul block" } function unshow() { menuul[0].className = "typeul" } for (var i = 0; i < menuli.length; i++) { menuli[i].num = i; var liul = menuli[i].getElementsByTagName("ul")[0]; if (liul) { typeshow() } } function typeshow() { menuli[i].onmouseover = showul; menuli[i].onmouseout = unshowul; } function showul() { menuli[this.num].getElementsByTagName("ul")[0].className = "block"; } function unshowul() { menuli[this.num].getElementsByTagName("ul")[0].className = ""; } } function clearSearch() { var txtValue = document.getElementById("skey").value; if (txtValue == "请输入产品关键字") { document.getElementById("skey").value = ""; } } function setSearch() { var txtValue = document.getElementById("skey").value; if (txtValue == "") { document.getElementById("skey").value = "请输入产品关键字"; } } function checkSearc() { var txtValue = document.getElementById("skey").value; if (txtValue == "" || txtValue == "请输入产品关键字") { alert("请输入您搜索的产品关键字"); return false; } return true; }