<SPAN size=”-1″>//这是$(<SPAN size=”-1″><EM>document).ready比较稳定的写法。</EM></SPAN></SPAN>
<SPAN size=”-1″>//jQuery.noConflict(); jQuery(document).ready(function(){});<BR></SPAN>
//但有人说
//$(document).ready(function(){
// alert(“hello”);
//});(1)
// <body onload=”alert(‘hello’);”>(2)
// 上面两段代码是等价的。但代码1的好处是做到表现和逻辑分离。并且可以在不同的js文件中做相同的操作,即$(document).ready (fn)可以在一个页面中重复出现,而不会//冲突。基本上Jquery的很多plugin都是利用这个特性,正因为这个特性,多个plugin共同使用起来。
//window.onload = function() { Notice(); }
function Notice2(){//定时器 热门促销
var pdata =”nameparam=”+document.getElementById(“nameparam”).value+”¶m=2″;
$.ajax({
url: “Util/MainUtil.aspx”, //后台处理类
type: “POST”,
data: pdata,
dataType: “html”,
timeout: 10000,
error: function(data) { },
success: function(data) {
$(“#scrollDiv2”).stop(true);
$(“#scrollDiv2>#ul2″).innerHTML=””;
//在容器中输出数据
$(“#scrollDiv2>#ul2”).html(data);
myar2 = setInterval(‘AutoScroll(“#scrollDiv2”)’, 2000)
$(“#scrollDiv2”).hover(function() { clearInterval(myar2); }, function() { myar2 = setInterval(‘AutoScroll(“#scrollDiv2”)’, 2000) }); //当鼠标放上去的时候,滚动停止,鼠标离开的时候滚动开始
}
});
}
$(function() {
$(“#ul2”).everyTime(300000, function(i) {//每5分钟执行一次
Notice2();
});
});
function AutoScroll(obj) {
$(obj).find(“ul:first”).animate({
marginTop: “-25px”
}, 500, function() {
$(this).css({ marginTop: “0px” }).find(“li:first”).appendTo(this);
});
}
</script>
<style type=”text/css”>
ul, li
{
margin: 0;
padding: 0;
}
#scrollDiv1
{
width: 300px;
height: 25px;
line-height: 25px;
border: #ccc 0px solid;
overflow: hidden;
}
#scrollDiv1 li
{
height: 25px;
padding-left: 10px;
}
#scrollDiv2
{
width: 300px;
height: 25px;
line-height: 25px;
border: #ccc 0px solid;
overflow: hidden;
}
#scrollDiv2 li
{
height: 25px;
padding-left: 10px;
}
</style>
</head>
<body link=”#000000″ vlink=”#000000″ alink=”#000000″ onload=”Notice();Notice2()”>
<%–头部部分–%>
<table style=”margin-bottom: 4px” cellspacing=”0″ cellpadding=”0″ width=”910″ align=”center”










