<asp:TextBox ID="txtLoanCustId" runat="server" ReadOnly="True"></asp:TextBox><a id="cSel" href="javascript:void(0)" onclick="openNewWinSel();" title="">///选择客户
$("#<%=txtLoanCustId.ClientID %>").bind("click focus dblclick",function(){
TriggerOpenDlg($(this));
});//触发弹出窗口选择
function TriggerOpenDlg(obj){
obj.blur().next().trigger("click");//绑定事件后移走光标防止再次触发
}
//新窗口选择
function openDialog(url,width,height,txtText,txtHdn)
{
var intX,intY,intLeft,intTop;
intLeft=(screen.availWidth-intX)/2;
intTop=(screen.availHeight-intY)/2;
var sValue=showModalDialog(url,"","dialogWidth=" + width + "px;dialogHeight=" + height +"px;dialogTop=" + intTop + "px;dialogLeft=" + intLeft + "px;status=yes;help=no;scrollbars=no;" );
if(sValue!=undefined)
{
var sValueText=(sValue==undefined)?"":sValue.substring(0,sValue.indexOf("|"));
var sValueHdn=(sValue==undefined)?"":sValue.substring(sValue.indexOf("|")+1);
txtText.value=sValueText;
if(txtHdn!=undefined)
txtHdn.value=sValueHdn;
document.title+="";
}
}在IE中正常,而在firefox中弹出窗口会弹出两次。
$("#<%=txtLoanCustId.ClientID %>").bind("click focus dblclick",function(){
TriggerOpenDlg($(this));
});//触发弹出窗口选择
function TriggerOpenDlg(obj){
obj.blur().next().trigger("click");//绑定事件后移走光标防止再次触发
}
//新窗口选择
function openDialog(url,width,height,txtText,txtHdn)
{
var intX,intY,intLeft,intTop;
intLeft=(screen.availWidth-intX)/2;
intTop=(screen.availHeight-intY)/2;
var sValue=showModalDialog(url,"","dialogWidth=" + width + "px;dialogHeight=" + height +"px;dialogTop=" + intTop + "px;dialogLeft=" + intLeft + "px;status=yes;help=no;scrollbars=no;" );
if(sValue!=undefined)
{
var sValueText=(sValue==undefined)?"":sValue.substring(0,sValue.indexOf("|"));
var sValueHdn=(sValue==undefined)?"":sValue.substring(sValue.indexOf("|")+1);
txtText.value=sValueText;
if(txtHdn!=undefined)
txtHdn.value=sValueHdn;
document.title+="";
}
}在IE中正常,而在firefox中弹出窗口会弹出两次。
///选择客户
$("#<%=txtLoanCustId.ClientID %>").bind("click focus dblclick",function(){
TriggerOpenDlg($(this));
});这段代码最好不要动。谢谢。
$("#<%=txtLoanCustId.ClientID %>").bind("click",function(){
alert('click');
TriggerOpenDlg($(this));
});
$("#<%=txtLoanCustId.ClientID %>").bind("focus",function(){
alert('focus');
TriggerOpenDlg($(this));
})
...dbclick一样写