如何检查Wheater光标是否存在于asp.net文本框中或jquery或javascript中不存在 [英] how to check wheather cursor is present on the asp.net textbox or not in jquery or javascript

查看:63
本文介绍了如何检查Wheater光标是否存在于asp.net文本框中或jquery或javascript中不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net texbox作为

Hi, I have a asp.net texbox as

<asp:TextBox ID="TextBox2" onblur="myfunction()"  runat="server"></asp:TextBox>


和按钮

<input type="button" id="Button1" onclick="dosomething()" value="Click Me!ajax" />





function myfunction(){
alert("textbox onblur");
}     
function dosomething(){
alert("button onclick");
}                                              



每当我在texbox上写东西,然后按tab或单击表格
中的任何位置时



Whenever I write something on the texbox and press tab or click anywhere in the form

alert("textbox onblur");

已执行,但是问题是,如果我不按Tab或单击表格并直接尝试按按钮
onblur方法未执行,首先执行按钮onclick事件,最后执行onblur,请帮助.我希望先执行onblur.

is executed ,But the problem is ,if i dont press tab or click on the form and directly try to press the button
onblur method is not executed ,first the button onclick event is executed and at last the onblur is executed ,plz help.I want the onblur should be executed first.

推荐答案

据我所见,您正在使用ajax调用. ajax是服务器端代码.这需要时间,而客户端代码则需要执行.您必须同步它.在Ajax调用中使用asynckeyword.
例如.

as per i can see, you are using ajax call. ajax is server side code.which takes time, in mean while client side code get executed. you have to synchronizes it. using asynckeyword in ajax call.
eg.


.ajax({ 异步:错误, 网址:url, 数据:{posNo:
.ajax({ async: false, url: url, data:{ posNo :


( this ).parents(' tr').find(' input [id * ="ordPosno"]').val(),tranDate:
(this).parents('tr').find('input[id*="ordPosno"]').val(), tranDate :


这篇关于如何检查Wheater光标是否存在于asp.net文本框中或jquery或javascript中不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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