js 之 jQuery 判断是否包含在数组中.inArray()jQuery .tmpl(), .template()

[img][/img]
	


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="/bh/style/middle_style.css" rel="stylesheet" type="text/css"/>
<script src="/bh/pjs/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="/bh/pjs/jquery.wresize.js" type="text/javascript"></script>
<script src="/bh/pjs/contentboxdivresiez.js" type="text/javascript"></script>
<script src="/bh/pjs/tab_style.js" type="text/javascript"></script>
<script src="/bh/pjs/table_litmenu_100.js" type="text/javascript"></script>
<script type="text/javascript" src="/bh/pjs/jquery.tmpl.js"></script>
<script type="text/javascript" src="/bh/pjs/bindpage.js"></script>
<script src="/bh/pjs/jquery2.json.js" type="text/javascript"></script>
<script src="/bh/pjs/encode.js" type="text/javascript"></script>
<script src="/bh/pjs/commin_yin.js" type="text/javascript"></script>
<script id="AccessStrategyTmpl" type="text/x-jquery-tmpl">

	<tr>
		<td style="width:450px"><span style="width:450px" class="kill">{{if AccountName==""}} - {{else}}${AccountName}{{/if}}</td>
		<td style="width:300px"><span style="width:300px" class="kill">${Protocols}</td>
		<td>${LastPwdModify}</td>
		<td class="mangerlei">{{if menushowhide=='true'}}[url=#@]手工修改[/url][b]|[/b]{{/if}}[url=manualpwd_info.cgi?${SessionId}&accountid=${HostAccountId}&tasktype=1]下载密码[/url]{{if mailaddr}}[b]|[/b][url=manualpwd_info.cgi?${SessionId}&accountid=${HostAccountId}&tasktype=2&mailaddr=${MailAddr}]发送密码[/url]{{/if}}{{if menushowhide=='true'}}[b]|[/b][url=manualpwd_history.cgi?${SessionId}&isaccount=1&hostid=${HostId}&accountid=${HostAccountId}]改密历史[/url]{{/if}}</td>
	</tr>

</script>

<script type="text/javascript">





function PwdHostAccountBind(){
		var newdata = new Array();
		$.each(PwdHostAccountList.data,function(i,item){
			var Protocols = item.ProtocolName;
			//12-5
			var menushow=false;
			$(item.ProtocolName).each(function(i,item2){
				if($.inArray(item2,menushowi)>=0){
					menushow=false;
					return false;
				}else{
					//if(item2=="RDP"&&item.SystemAccount!=true){menushow=false;}else{menushow=true}
					menushow=true;
				}
			})
			newdata.push("{AccountName:\""+item.AccountName+"\",Protocols:\""+Protocols+"\",LastPwdModify:\""+item.LastPwdModify+"\",HostAccountId:\""+item.HostAccountId+"\",menushowhide:\""+menushow+"\"}");
		});
		//12-5
		newdata = eval("["+newdata+"]");
		$(newdata).each(function(i,item){
			item.SessionId=localsession;
			item.HostId=hostid;
			item.MailAddr=mailaddr;
			if(mailaddr==""){
				item.mailaddr=false;
			}else{
				item.mailaddr=true;
			}
		})
		$("#AccessStrategyTmpl").tmpl(newdata).appendTo("#PwdHostAccountId");
	}




var menushowi=["HTTP","RADMIN","PCANY","FTP","VNC","X11","OTHER"]
</script>
<style>
#head_tit_selectbox ul li{padding-bottom:0;line-height:20px}
</style>
<title>无标题文档</title>
</head>
<body scroll="no">
<div class="head-box">
[list]
<li class="one">[url=#@]主机:<span id="HostNameId"></span>[/url]</li>
[*][url=#@]改密历史[/url]

[/list]
</div>

<div id="tabledivbox" >
<!--此div为小菜单--><div id="poslitmenubox"><div id="poslitmenu"></div></div>
<!--表头-->
<div style="border:1px solid #ccc;border-top:none;width:100%;position:absolute;height:29px;z-index:0;margin-left:-1px;">
</div>
<div class="faux-head">
<table border="0" cellspacing="0" cellpadding="0" style="width:100%;" id="tab-head">
<thead>
<tr>
<th style="width:450px">帐号</th>
<th style="width:300px">协议</th>
<th style="background-image:none">密码修改时间</th>
<th class="mangerlei">管理</th>
</tr>
</thead>
</table>
</div>
<div style="height:29px;width:100%;background:#f2f2f2;"></div>
<!--此div包含作用为出滚动条-->
<div class="tableboabox">
<table border="0" cellspacing="0" cellpadding="0" style="width:100%;" id="content">
<!--此处为表格实际宽度,如果表格不需要出现小菜单则把表格宽度设为100%-->
<tbody id="PwdHostAccountId">
</tbody>
</table>
</div>
</div>
<div class="fenyelistbox">
		[list]
			<li style="margin-right:5px"><span id="pageinfospan"></span>[url=#@]上一页[/url]
			 [url=#@]下一页[/url] </li>
			<li>
				<input name="" type="text"/>
			</li>
			<li>
				<input name="" type="button" class="btn" value="跳转"/>
			</li>
		[/list]
	</div>
<div class="dialog" id="Dialog01" style="width:306px;height:150px">
	<div class="dialog-bg-1"></div>
	<div class="dialog-cont" style="width:306px">
		<div class="dialog-title" style="width:286px">
			<h2>手工修改密码</h2>
			<a class="dialog-close" href="javascript:void(0)"></a>
		</div>
		
		<div class="dialog-content dialog1" style="width:276px;height:90px">
			
				<span>密码:</span>
                <span><input id="GeneratePwd" name="" type="password" class="textbox" value=""/><input id="GeneratePwd-2" name="" type="password" size="22" class="textbox" value="" style="width:146px;display:none"/></span>
                <span>[url=#@]随机密码[/url]</span>
			
            
				<span>确认:</span>
                <span><input id="PwdCheck" name="input2" type="text" class="textbox" value=""/><input id="PwdCheck-2" name="input2" type="password" size="22" class="textbox" value="" style="width:146px;display:none"/></span>
			
			
				<input type="button" value="确定" onclick="passcheck()"/>
			
		</div>
	</div>
</div>
</body>
</html>



//.inArray()

var menushowi=["HTTP","RADMIN","PCANY","FTP","VNC","X11","OTHER"]
$.inArray("HTTP", menushowi);  //返回 3,
如果不包含在数组中,则返回 -1;

//勾选框灰掉
var account=localaccount;
$("#UOwner input").each(function(i,item){//默认第一个接收者勾选
    if(i == 0){
	$(this).attr({"checked":true});
     }	
			
});

你可能感兴趣的:(js)