12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- function getSelectedTabID() {
- return tabID = $('.mod-tabs-trigger .selected').first().attr('id');
- }
- function searchHeroes(searchKey)
- {
- var size = allHeroes.length;
- var outputHtml = '搜索结果:';
- for(var i=0;i<size;i++){
- {
- var ename = allHeroes[i].ename;
- var cname = allHeroes[i].cname;
- var title = allHeroes[i].title;
- if((ename!=null && ename.toLowerCase().indexOf(searchKey.toLowerCase()) > -1) || (cname!=null && cname.indexOf(searchKey) >-1) || (title!=null&&title.indexOf(searchKey) >-1))
- {
- outputHtml += "<a href='heroTop10Players.php?hero="+encodeURI(ename)+"'>"+cname+"("+title+")</a> ";
- }
- }
- }
- $('#searchResult').html(outputHtml);
- }
- $( document ).ready(function() {
- $('#searchKey').focus(function() {
- if(this.value=='请输入英雄名称关键字') {
- this.value='';
- }
- });
- $("#searchKey").keyup(function (event) {
- if (event.keyCode == 13) {
- searchHeroes(document.getElementById('searchKey').value);
- }
- });
- $('#btnHeroSearch').bind("click", function (event) {
- searchHeroes(document.getElementById('searchKey').value);
- });
- // binding for tab onClicked
- $('.mod-tabs-trigger li').bind('click', function(event) {
- $(this).siblings().removeClass('selected').end().addClass('selected');
- var rankType = getSelectedTabID();
- if (rankType == 'R_S_5') {
- window.location = 'rankScoreRank.php';
- } else if (rankType == 'zdlRank') {
- window.location = 'zdlRank.php';
- } else if (rankType == 'heroRank') {
- window.location = 'heroesRank.php';
- }
- });
- });
|