通用弹框js
1、
js部分:
function checkIsLogon(id){
var uname= $.cookie("jchome_userName");
$("#dd").show();
if(uname==null){
logonjsp(id);
}
}
function logonjsp(id){
$.post(
"views/guide/logon.jsp",
{id:id},
function(data){
openlogon(data);
}
) ;
}
function openlogon(str){
$('#title').html(str);
$("#dd").dialog({
title: "登陆",
buttons:[{
text:'关闭',
handler:function(){
$('#dd').dialog('close');
}
} ]
});
}
页面部分:
<div id="dd" icon="icon-save" style="padding:5px;width:450px;height:220px;display:none;">
<p id="title"></p>
</div>
<p class="chbox"><textarea name="neirong" id="neirong" onclick="checkIsLogon(${dbb.id });"></textarea></p>
登陆页面:
<div style="margin-top:20px;">
<form action="loginDiscuss" method="post" name="form1" >
帐号:<input type="text" name="account" size="18" maxlength="18"><br/><br/>
密码:<input type="password" name="pwd" size="18" maxlength="18"><br/><br/>
<input type="hidden" name ="did" value="<%=id %>"/>
<input type="submit" name="Submit" value="登 录">
</form>
<iframe style=" display: none;" name="logon1"></iframe>
</div>
2、第二种为blockUI:
function adddatabasehf(id){
$.blockUI({
theme: true,
title: '您的评论:', // only used when theme == true
message:'<table width="100%"><tr><td align=left>'+
'<div color=#232324><label left=10>评论不能超过256个字符,您还可以输入</label>'+
'<label id="limitLength">256</label>'+
'<label>个字符</label><div></td></tr><tr><td>' +
'<textarea name="message" rows="4" cols="60" id="neirong"'+
'onpropertychange="textCounter(message,256);"></textarea>'+
'</td></tr><tr><td align=center>'+
'<input type="button" value="提交" onclick="sub('+id+');"/> '+
'<input type="button" value="取消" onclick="javascript:cancer();"/>'+
'</td></tr></table>'
});
}