调用Onchange事件时如何锁定Firefox中的用户单击事件? [英] How to Lock the User Click Event in Firefox when Onchange Event Called?

查看:51
本文介绍了调用Onchange事件时如何锁定Firefox中的用户单击事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个Web服务来检查用户名是否已经存在.

我已经将Web Service称为.cs(隐藏代码)文件,如下所示.

Hi to all,

I have a Web Service to Check the User Name is Already Exists or Not.

I have called the Web Service In .cs(Code Behind) file like Following.

txtUserName.Attributes.Add("onChange","return CheckUserNameAvailability()");


function CheckCommonMasterAvailability() {
//    debugger;
    masterCheck = document.getElementById('ctl00_cphMaster_hdnStatus');
    setTimeout("", 10000);
    if ((document.getElementById('ctl00_cphMaster_hdnValue').value == "") || (document.getElementById('ctl00_cphMaster_hdnValue').value.toUpperCase() != Trim(txtCommonName.value().toUpperCase()))) {
        if ((ddlReferenceCode.value() != "0") && (Trim(txtCommonName.value()) != "")) {
            masterValue = Trim(txtCommonName.value());
            SCMService.CheckMasterAvilability("COMMONMASTER", Trim(txtCommonName.value()), ddlReferenceCode.value(), "", "", "", OnMasterCheck);
            return false;
        }
    }
    else {
        masterCheck.value = "0";
    }
}







如果假设用户输入名称并突然单击保存按钮,则onChange事件将不会在控件进入服务器之前突然执行,因此将其保存,然后调用onchange事件.

我检查通过webservice方法返回的状态值.但是将控制权转到服务器后调用的方法,然后执行onchange事件.

它在IE中可以正常运行,但在FireFox中却不能..
我该如何解决这个问题?

还有其他方法吗?

感谢all







if Suppose the user enter the name and suddenly click the save button the onChange event wont perform Suddenly before the control is going to server, so it saved and then the onchange event called.

i check the status value that is return by webservice method. but the method called after control is going to server and then the onchange event is performed.

It Works Properly in IE but not in FireFox..
How can i solve this problem?

Is there any other way to do this?

Thanks to all

推荐答案

是的.

通过Button延迟提交表单.您可以使用button的OnClientClick属性来挂接Javascript方法,以延迟提交.

首先执行JS Click方法,然后执行服务器onClick.这将为您节省一些时间,根据您的需要进行操作.
Yes.

Delay the form submission by Button. You can use OnClientClick property of button to hook a Javascript method where you can delay the submission.

First the JS Click method is executed and then the server onClick. This will buy you some time to manipulate as per your need.


这篇关于调用Onchange事件时如何锁定Firefox中的用户单击事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆