日期:2014-05-16 浏览次数:20378 次
<ul></ul>
<a></a>
<div id="div_1"></div>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gbk" />
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<style>
</style>
</head>
<body>
<ul><li>1</li></ul>
<ul><li>2</li></ul>
<ul><li>3</li></ul>
<a>4</a>
<div id="div_1">5</div>
<script>
$('#div_1').prevUntil('ul').prev().hide()
</script>
</body>
</html>
function findingUl() {
var obj = document.getElementById("div_1");
while (obj) {
if (obj.tagName&&obj.tagName.toLowerCase() == "ul") {
obj.style.display = "none";
break;
}
else {
obj = obj.previousSibling;
}
}
}