日期:2014-05-16 浏览次数:20514 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#selbtn88").click(function(){//选择日历插件时,回到顶部
$("html,body").animate({"scrollTop":"0"},"slow")
})
});
</script>
</head>
<body>
<div style="height:1500px">aaaaa</div>
<div style="height:800px"><span id="selbtn88">123456</span></div>
<div style="height:1500px"></div>
</body>
</html>
$("span[id^=selbtn]").click(function(){//选择日历插件时,回到顶部
$("html,body").animate({"scrollTop":"0"},"slow")
})
$(document).click(function(event){
var target = event.target,
$target = $(target);
if(/^selbtn(\d
------解决方案--------------------
_)+/.test($target.attr("id"))) {
$("html,body").animate({"scrollTop":"0"},"slow");
}
// 或者
$("body").click(function(event){
var target = event.target,
$target = $(target);
if(/^selbtn(\d
------解决方案--------------------
_)+/.test($target.attr("id"))) {
$("html,body").animate({"scrollTop":"0"},"slow");
}
});