文本框txtUserName 的Onbulr 绑定方法 txtUserNameOnblur  这可以正常执行

而下面的btnRegister 的click 事件则无法正常调用    txtUserNameOnblur ()

不知道是不是ajax的回调函数调用问题,求助

$("#txtUserName").bind("blur",txtUserNameOnblur);
function txtUserNameOnblur() { if ($("#txtUserName").val() != "") {
$.post("../../Myashx/CheckRegister.ashx", { "txtUserName": $("#txtUserName").val(),"CheckType":"CheckUserName" }, function (result) {
if (result == "NotExist") {
$("#msgUserName").removeClass("errorMsg"); $("#msgUserName").addClass("successMsg");
$("#msgUserName").text(" √"); return true;
} else if (result == "Exist") {
$("#msgUserName").removeClass("successMsg"); $("#msgUserName").addClass("errorMsg");
$("#msgUserName").text(" ×"); showHeaderMsg("errorMsg", "successMsg", "用户名已经存在"); return false; }
});
}
else {//用户名为空!
$("#msgUserName").text(" ×");
$("#msgUserName").removeClass("successMsg");
$("#msgUserName").addClass("errorMsg"); return false; }
} $("#btnRegister").click(function () {
if (txtUserNameOnblur()) {//undefined
} else {
showFooterErrorMsg("* 以上信息有误,请完善注册信息 * ");
}
});

  

求助,JS 方法调用的问题,写了返回值,确调用时返回Undefined(新人第一次写)的更多相关文章

  1. python 四种方法修改类变量,实例对象调用类方法改变类属性的值,类对象调用类方法改变类属性的值,调用实例方法改变类属性的值,直接修改类属性的值

    三种方法修改类变量,实例对象调用类方法改变类属性的值,类对象调用类方法改变类属性的值,调用实例方法改变类属性的值,类名就是类对象,city就是类变量, #coding=utf-8 class empl ...

  2. C#_delegate - 有返回值手工调用

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  3. C# 调用 C++ 的 DLL 返回值为 bool 时,值混乱

    现象:C++ 导出函数的返回值为 false,C# 调用该函数获取的返回值却为 true . 原因:C++ 导出函数返回 false 时,采取的方式是: 将 C# 定义的用来接收返回值的 bool 所 ...

  4. jquery的异步获取返回值为中文时乱码解决方法

    用jqgrid异步获取列表值,遇到个问题,服务器端从数据库取到的数据没有出现中文乱码问题(日志打出来是没有乱码的),但是异步传到客户的时候却出现了乱码. 服务器端已经编码过了(UTF-8编码).开始一 ...

  5. Python3基础 定义无参数无返回值函数 调用会输出hello world的函数

    镇场诗: 诚听如来语,顿舍世间名与利.愿做地藏徒,广演是经阎浮提. 愿尽吾所学,成就一良心博客.愿诸后来人,重现智慧清净体.-------------------------------------- ...

  6. SpringMVC方法的返回值类型和自动装配

    1. void类型作为返回值类型 /** * 如果方法写成了void就跟原来servlet含义是差不多 的 * json */ @RequestMapping("/firstRequest& ...

  7. Spring MVC的方法返回值和参数传递

    1. SpringMVC方法的返回值类型 3.1String类作为返回值 3.1.1Controller层 /** * 返回值类型为String时,一般用于返回视图名称 * 1.当方法返回值为null ...

  8. c#代码 天气接口 一分钟搞懂你的博客为什么没人看 看完python这段爬虫代码,java流泪了c#沉默了 图片二进制转换与存入数据库相关 C#7.0--引用返回值和引用局部变量 JS直接调用C#后台方法(ajax调用) Linq To Json SqlServer 递归查询

    天气预报的程序.程序并不难. 看到这个需求第一个想法就是只要找到合适天气预报接口一切都是小意思,说干就干,立马跟学生沟通价格. ​ ​不过谈报价的过程中,差点没让我一口老血喷键盘上,话说我们程序猿的人 ...

  9. C# 中直接调用js方法

    请注意,我这段代码中实现js方法中有 funcName(argument) 这种一个入参的调用. using System; namespace game2_36.Common { public cl ...

随机推荐

  1. This application is modifying the autolayout engine from a background threa-线程错误

    警告提示:This application is modifying the autolayout engine from a background thread, which can lead to ...

  2. jQuery简介及语法

    jQuery引入 jQuery语法

  3. ZoomBar 设计

    package com.example.canvasdemo; import android.content.Context; import android.graphics.Canvas; impo ...

  4. CSS3 border-image详解、应用

    一.border-image的兼容性 border-image可以说是CSS3中的一员大将,将来一定会大放光彩,其应用潜力真的是非常的惊人.可惜目前支持的浏览器有限,仅Firefox3.5,chrom ...

  5. HTML5 Web Storage

    Web Storage是HTML5 API提供一个新的重要的特性: 最新的Web Storage草案中提到,在web客户端可用html5 API,以Key-Value形式来进行数据持久存储: 目前主要 ...

  6. 关于xfce中桌面没法显示回收站以及thunar中无法进行卷管理的解决办法

    出现这种问题的原因应该不是当前用户没在storage这个组里,因为我试过将用户从storage组里移除并不对影响桌面上回收站的显示. 问题的原因是没有安装gvfs这个软件,装上之后,重新登录当前用户, ...

  7. vs extension

    优先级高低

  8. UBI系统原理分析【转】

    转自:http://blog.chinaunix.net/uid-28236237-id-4164656.html 综述 UBI全称Unsorted Block Images,是一种原始flash设备 ...

  9. CSS 笔记六(Image/Attribute Selectors)

    Image Opacity / Transparency The CSS opacity property is a part of the CSS3 recommendation. Example ...

  10. 关于mysql中int(1)中int后面的数字

    mysql在建表的时候int类型后的长度代表什么? 是该列允许存储值的最大宽度吗? 为什么我设置成int(1), 也一样能存10,100,1000呢.  当时我虽然知道int(1),这个长度1并不代表 ...