用jquery动态加载TAB请求帮助! 本帖最后由 kempinsun 于 2011-11-05 00:29:51 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 几个提示,应该有所帮助:1 可直接用$('#pageContent').load('url')替换你的$.ajax方法2 $('#loading').ajaxStart(function(){$(this).show()}).ajaxStop(function(){$(this).hide()})可全局控制等待标示的显示与隐藏3 setInterval("checkURL()",250);干嘛的??4 选中时的背景色实现 ,可在点击选项卡时添加样式(addClass()) css:.evenClass{ background-color: #EFFFFE; }.mouseMove{ background-color: #5E94C6; }js: $(function(){ $("#dataForm tr:nth-child(odd)").addClass("evenClass"); $("#dataForm tr").mouseover(function() { $(this).addClass("mouseMove"); }).mouseout(function() { $(this).removeClass("mouseMove"); }) });jsp显示的table:<table width="100%" cellspacing="0" id="dataForm"><tr></tr> <html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>Common Place Mapping</title> <style type="text/css"> body { color: #6C6C6C; font: 12px/21px "宋体"; margin: 0;}.main_Jiu_Change { border: 1px solid #D9D9D9; color: #6C6C6C; float: right; height: 204px; width: 710px;} ul, ol, li, dl, dd, dt, p, h1, h2, h3, h4, h5, h6, form, input { margin: 0; padding: 0;}.main_Jiu_Change .hd ul li.selected { color: #4A7F07;}.main_Jiu_Change .hd ul li { color: #00000; cursor: pointer; font: 16px/23px "微软雅黑"; height: 66px; padding-top:5px; text-align: center; width: 66px; list-style: none ;}.main_Jiu_Change .hd ul{ overflow:hidden; height:204px; }.dl_tj { width:200px; float:left; margin-left: -1px; }.main_Jiu_Change .hd { background-image:url("biaoqian.gif"); float:right; height: 204px; position:relative; width: 68px;} .hd1 { background-position:0 0; } .hd2{ background-position: -117 0 ; } .hd3 { background-position: -237 0 ; } </style></head><body> <form runat="server" id="form1"> <div class="main_Jiu_Change" collection="Y"> <!--切换开始--> <div id='chose' class="hd hd1"><!--hd1 hd2 hd3分别代表三个TAB块背景--> <ul id="j-theatre"> <li clz="hd1" class="selected">热点<br>推荐</li> <li clz="hd2" class="">AA<br>视角</li> <li clz="hd3" class="">BB<br>课程</li> </ul> </div> <!--切换 end--><!--1111111111111111111111111111111111111111111111111111111111111111111111111111--><div style="float: right" id="j-theatre-body"> <div style="display:none" > <dl class="dl_tj"> <dt>热点推荐</dt> <dd></dd> </dl> <dl class="dl_tj"> <dt id="tvb_theatre_dt">热点推荐</dt> <dd id="tvb_theatre_dd"></dd> </dl> <dl class="dl_tj borNone"> <dt>热点推荐</dt> <dd> </dd> </dl></div> <!--2222222222222222222222222222222222222222222222222222222222222222--> <div style="display: none;" > <dl class="dl_tj"> <dt>AA视角</dt> <dd></dd> </dl> <dl class="dl_tj"> <dt>AA视角</dt> <dd></dd> </dl> <dl class="dl_tj borNone"> <dt>AA视角</dt> <dd></dd> </dl> </div> <!--3333333333333333333333333333333333333333333333333333333333333333333333--> <div style="display: none;" > <dl class="dl_tj"> <dt></dt><dd>BB课程</dd> </dl> <dl class="dl_tj"> <dt></dt><dd>BB课程</dd> </dl> <dl class="dl_tj borNone"> <dt></dt> <dd>BB课程</dd> </dl> </div></div> </form></body> <script type="text/javascript"> window.onload = function() { var choseDiv = document.getElementById("chose"); var lis=document.getElementById('j-theatre').getElementsByTagName('li'); var showDiv=document.getElementById('j-theatre-body').getElementsByTagName('div'); showDiv[0].style.display='block'; for(var i=0;i<lis.length;i++) { var liCur=lis[i]; var style=liCur.getAttribute('clz'); lis[i].onmousemove = function(num,T,li) { return function() { for(var j=0;j<showDiv.length;j++){ if(j==num) { showDiv[j].style.display='block'; lis[j].className='selected'; } else { showDiv[j].style.display='none'; lis[j].className=''; } } var clz='hd '+T.toString(); choseDiv.className=clz; } }(i,style,liCur); } }; </script> </html> ajax报错 400 BadRequest ztree不能获取焦点 js 复制数组后更改原始数组,新数组值也被改变 求解 ExtJs4 grid extjs4.0 MVC 变更proxy的url 以及查询条件 javascript图片抖动的小问题,郁闷中....... javascript的一个畸形问题,求解决办法,不难的... 一个asp和java合用的问题(java更重)!请高手指教!在线等! 请问如何才能得到<span id="rendo">hello!</span>中的值?等待中...... 框架应用的问题 请问如何根据输入的月份知道次月共有几周? jquery 字符长度的限制问题
1 可直接用$('#pageContent').load('url')替换你的$.ajax方法
2 $('#loading').ajaxStart(function(){$(this).show()}).ajaxStop(function(){$(this).hide()})可全局控制等待标示的显示与隐藏
3 setInterval("checkURL()",250);干嘛的??
4 选中时的背景色实现 ,可在点击选项卡时添加样式(addClass())
.evenClass{
background-color: #EFFFFE;
}
.mouseMove{
background-color: #5E94C6;
}
js:
$(function(){
$("#dataForm tr:nth-child(odd)").addClass("evenClass");
$("#dataForm tr").mouseover(function() {
$(this).addClass("mouseMove");
}).mouseout(function() {
$(this).removeClass("mouseMove");
})
});jsp显示的table:
<table width="100%" cellspacing="0" id="dataForm"><tr></tr>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Common Place Mapping</title>
<style type="text/css">
body {
color: #6C6C6C;
font: 12px/21px "宋体";
margin: 0;
}
.main_Jiu_Change {
border: 1px solid #D9D9D9;
color: #6C6C6C;
float: right;
height: 204px;
width: 710px;
}
ul, ol, li, dl, dd, dt, p, h1, h2, h3, h4, h5, h6, form, input {
margin: 0;
padding: 0;
}.main_Jiu_Change .hd ul li.selected {
color: #4A7F07;
}.main_Jiu_Change .hd ul li {
color: #00000;
cursor: pointer;
font: 16px/23px "微软雅黑";
height: 66px;
padding-top:5px;
text-align: center;
width: 66px;
list-style: none ;
}.main_Jiu_Change .hd ul
{
overflow:hidden;
height:204px;
}.dl_tj {
width:200px;
float:left;
margin-left: -1px;
}.main_Jiu_Change .hd {
background-image:url("biaoqian.gif");
float:right;
height: 204px;
position:relative;
width: 68px;
}
.hd1 {
background-position:0 0;
} .hd2{
background-position: -117 0 ; } .hd3 {
background-position: -237 0 ;
}
</style>
</head>
<body> <form runat="server" id="form1">
<div class="main_Jiu_Change" collection="Y">
<!--切换开始-->
<div id='chose' class="hd hd1"><!--hd1 hd2 hd3分别代表三个TAB块背景-->
<ul id="j-theatre">
<li clz="hd1" class="selected">热点<br>推荐</li>
<li clz="hd2" class="">AA<br>视角</li>
<li clz="hd3" class="">BB<br>课程</li>
</ul>
</div>
<!--切换 end-->
<!--1111111111111111111111111111111111111111111111111111111111111111111111111111-->
<div style="float: right" id="j-theatre-body">
<div style="display:none" >
<dl class="dl_tj">
<dt>热点推荐</dt>
<dd></dd>
</dl> <dl class="dl_tj">
<dt id="tvb_theatre_dt">热点推荐</dt>
<dd id="tvb_theatre_dd"></dd>
</dl> <dl class="dl_tj borNone">
<dt>热点推荐</dt>
<dd>
</dd>
</dl>
</div>
<!--2222222222222222222222222222222222222222222222222222222222222222-->
<div style="display: none;" >
<dl class="dl_tj">
<dt>AA视角</dt>
<dd></dd>
</dl>
<dl class="dl_tj">
<dt>AA视角</dt>
<dd></dd>
</dl> <dl class="dl_tj borNone">
<dt>AA视角</dt>
<dd></dd>
</dl>
</div>
<!--3333333333333333333333333333333333333333333333333333333333333333333333-->
<div style="display: none;" >
<dl class="dl_tj">
<dt></dt><dd>BB课程</dd>
</dl> <dl class="dl_tj">
<dt></dt><dd>BB课程</dd>
</dl>
<dl class="dl_tj borNone">
<dt></dt>
<dd>BB课程</dd>
</dl>
</div>
</div>
</form>
</body>
<script type="text/javascript">
window.onload = function() {
var choseDiv = document.getElementById("chose");
var lis=document.getElementById('j-theatre').getElementsByTagName('li');
var showDiv=document.getElementById('j-theatre-body').getElementsByTagName('div');
showDiv[0].style.display='block';
for(var i=0;i<lis.length;i++)
{
var liCur=lis[i];
var style=liCur.getAttribute('clz');
lis[i].onmousemove = function(num,T,li)
{
return function()
{
for(var j=0;j<showDiv.length;j++){
if(j==num)
{
showDiv[j].style.display='block';
lis[j].className='selected';
}
else
{
showDiv[j].style.display='none';
lis[j].className='';
}
}
var clz='hd '+T.toString();
choseDiv.className=clz;
}
}(i,style,liCur);
}
}; </script>
</html>