標籤:需要 cat 查看 document color read ice mst hid
讓當前頁面顯示整個螢幕
$(document).ready(function(){
if(window.top != window.self)
window.top.location.href = location.href;
});
自動執行
$(function() { $("table tr:nth-child(even)").addClass("even"); //任何需要執行的js特效 });
<body onload="myfunction()">
$(document).ready(function() {
int();
});
js控制div顯示與隱藏
<span style="display:none;">*不保留位置</span>
<span style="visibility:hidden;">*保留位置</span>
var target=document.getElementById(targetid);
var clicktext=document.getElementById(objN)
if (target.style.display=="block"){
target.style.display="none";
clicktext.innerText="點擊查看詳細資料";
} else {
target.style.display="block";
clicktext.innerText=‘關閉詳細資料資訊‘;
}
隱藏欄位
<input type="hidden" name="field_name" value="value">
vararrayApprovePeople =[];//定義數組
var sortArray=[];//排序數組
arrayApprovePeople[16]=data.jsonmap[‘Hour_22‘] ;//後台傳map,取值
arrayApprovePeople[17]=data.jsonmap[‘Hour_23‘] ;
sortArray =arrayApprovePeople.slice();//數組複製,新的數組
sortArray.sort(function(a,b){ return a-b});//數組排序 a-b由小到大,b-a由大到小
var first=arrayApprovePeople.indexOf(sortArray[17]);//對應值在數組中的位置
var second=arrayApprovePeople.indexOf(sortArray[16]);
var third=arrayApprovePeople.indexOf(sortArray[15]);
arrayApprovePeople[first]={value:sortArray[17],itemStyle:{normal:{color:‘#e63f3f‘}}};//對應位置的數組賦值
arrayApprovePeople[second]={value:sortArray[16],itemStyle:{normal:{color:‘#ef931c‘}}};
arrayApprovePeople[third]={value:sortArray[15],itemStyle:{normal:{color:‘#35a165‘}}};
setTimeout(function(){getApFlow() ;//1秒後執行 },1000);
js取時間,AddDayCount 為負數則為昨天的時間
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//擷取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth()+1;//擷取當前月份的日期
var d = dd.getDate();
return y+"-"+m+"-"+d;
}
js千位符
function thousandBitSeparator(num) {
var num = (num || 0).toString(), result = ‘‘;
while (num.length > 3) {
result = ‘,‘ + num.slice(-3) + result;
num = num.slice(0, num.length - 3);
}
if (num) { result = num + result; }
return result;
}
點擊<a href="#" >標籤回到頁面頂部,實則應該保持頁面不動。
解決,a標籤中加 href="JavaScript:void(0)" ,點擊a標籤就不會跳到頁面頂部了
<a href="JavaScript:void(0)" page="${pageView.currentPage + 1}" id="devicesUlLiNext">下一頁</a>
js和jQuery的代碼