贴一段jquery代码

<script type=”text/javascript”>
$(document).ready(function() {
$(“#pages”).change(function(){
page = $(“#pages”).val();
start_time = $(“#starttime”).val();
end_time   = $(“#endtime”).val();
getls = $(“#leadstatus”).val();

$(“#loading”).attr(“style”,”display:none; textalign:center; position:absolute;background-color:#000; filter:alpha(opacity=80);opacity:.8;”);
$(‘#loading’).height($(document).height() + “px”);
$(‘#loading’).width($(document.body).outerWidth(true) + “px”);

var topPosition = document.documentElement.scrollTop + ($(window).height() – $(“#mdiv”).height()) / 2;

$(“#mdiv”).attr(“style”,”z-index:1000;left:50%; margin-left:-105px;position:absolute; display:none;background-image:url(../imgs/ldbg.png); background-repeat:no-repeat; height:189px; width:331px;top:”+topPosition+”px”);

$(‘#loading’).fadeIn();
$(‘#mdiv’).fadeIn();
//$(“#loading”).attr(“style”,”z-index:999; padding-top:200px; margin-left:0px;position:absolute;display:block; background-color:#000; filter:alpha(opacity=80);opacity:.8;”);

if(getls!=””){
url= “/ci.php/dashboard/page/”+page+”/”+getls+”/”+end_time+”/”+start_time;
}else{
url = “/ci.php/dashboard/page/”+page+”/all/”+end_time+”/”+start_time;
}

$.ajax({
type: ‘post’,
url: url,
cache:false,
success:function(html){

$(“#leadsdiv”).html(html);
$(“#loading”).attr(“style”,”display:none”);
$(“#mdiv”).attr(“style”,”display:none”);
}
});

});

$(“#datelead”).click(function (){
startt = $(“#starttime”).val();
endt   = $(“#endtime”).val();
datelead(endt,startt);
});

//—–search function
$(“#submit”).click(function (){
$(“#loading”).attr(“style”,”z-index:999; margin-left:0px; margin-top:300px;position:absolute;display:block; left: 416px; top: 31px; width:865px; height: 48px;”);
keyword = $(“#searchkeyword”).val();
if (keyword == “”){
alert(“keyword can’t be empty!”);
return false;
}
url = “/ci.php/dashboard/search/”+keyword;
$.ajax({
type: ‘post’,
url: url,
cache:false,
success:function(html){
$(“#leadsdiv”).html(html);
$(“#pagec”).html(“”);
$(“#loading”).attr(“style”,”display:none”);
$(“#mdiv”).attr(“style”,”display:none”);
}
});
});

});
function datelead(endtime,starttime){

getls = $(“#leadstatus”).val();

if(getls!=””){
location.href = “/ci.php/dashboard/index/”+getls+”/”+endtime+”/”+starttime;
}else{
location.href = “/ci.php/dashboard/index/all/”+endtime+”/”+starttime;
}

}
//$(“#loading”).attr(“style”,”display:none;”);
//document.getElementById(“loading”).style.display = “none”;
</script>

滚动至顶部