DIV 下拉列表例子
2012-04-13 17:42 aivj 阅读(171) 评论(0) 收藏 举报if (html != "") { var left = obj.offsetLeft + 349; var top = obj.offsetTop + 96; var width = 150; if (obj_hintDiv) { obj_hintDiv.innerHTML = html; obj_hintDiv.style.display = "block"; obj_hintDiv.style.position = "absolute"; obj_hintDiv.style.left = left; obj_hintDiv.style.top = top; obj_hintDiv.style.width = width; if (objDivDown) { objDivDown.style.display = "block"; objDivDown.style.position = "absolute"; objDivDown.style.left = left; objDivDown.style.top = top; objDivDown.style.width = width; objDivDown.style.height = obj_hintDiv.offsetHeight; } var table = obj_hintDiv.childNodes[0]; for (var i = 1; i < table.rows.length; i++) { table.rows[i].onmouseover = function() { this.style.backgroundColor = "blue"; for (var j = 0; j < this.cells.length; j++) { this.cells[j].style.color = "white"; } }
table.rows[i].onmouseout = function() { this.style.backgroundColor = ""; for (var j = 0; j < this.cells.length; j++) { this.cells[j].style.color = ""; } }
//获取物业分期ID和名称 table.rows[i].onclick = function() { if (obj) obj.value = this.cells[0].innerText; document.getElementById("Text1").value = parseFloat(this.cells[0].id) / 10000; if (typeof (closeHintCommDiv) != "undefined") closeHintCommDiv(); //隐藏物业分期面板
} } var hintDiv = document.getElementById("hintDiv"); //提示面板的上下键移动事件 if (hintDiv.style.display == "block") { document.onkeydown = function() { if (hintDiv.style.display == "block") { if (event.keyCode == "38") { moveTr(hintDiv.childNodes[0], event.keyCode); } if (event.keyCode == "40") { moveTr(hintDiv.childNodes[0], event.keyCode); } if (event.keyCode == "13") { if (g > 0 && g < hintDiv.childNodes[0].rows.length) { if (obj) obj.value = hintDiv.childNodes[0].rows[g].innerText; if (typeof (closeHintCommDiv) != "undefined") closeHintCommDiv(); //隐藏物业分期面板 } } } }
document.onkeyup = function() { if (hintDiv.style.display == "block") { if (event.keyCode == "38") { moveConfirm(hintDiv.childNodes[0], event.keyCode); } if (event.keyCode == "40") { moveConfirm(hintDiv.childNodes[0], event.keyCode); }
} }
} } }
浙公网安备 33010602011771号