js和jQuery的代碼

來源:互聯網
上載者:User

標籤:需要   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的代碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.