随笔分类 - JQuery
jquery虚拟数字键盘
摘要:来源:https://www.bbsmax.com/A/E35prpDyzv/ /** * 数字键盘插件 js */ //匿名函数 (function ($) { var _count = 0; //定义一个 Mynumkb 类,构造函数传入参数:element, options var Mynum
阅读全文
jquery操作checkbox
摘要:代码: //注意: 操作checkbox的checked,disabled属性时jquery1.6以前版本用attr,1.6以上(包含)建议用prop //1、根据id获取checkbox $("#cbCheckbox1"); //2、获取所有的checkbox $("input[type='che
阅读全文
ajax添加header信息
摘要:$.ajax({url:"xxx",async:true,dataType:"json",contentType:"application/json",data:{},beforeSend: function (XMLHttpRequest) {XMLHttpRequest.setRequestHe
阅读全文
jqPaginator分页(每次只取一页数据)
摘要:应用技术点:jqPaginator、template7、bootstrap.css 参考网址: jqPaginator:http://jqpaginator.keenwon.com/#a3 template7:http://idangero.us/template7/#.Wm6t1fmWaUk te
阅读全文
微信网页JS分享,微信二次分享无缩略图问题
摘要:很多时候我们要在微信中分享h5网页,这个时候就得用微信的分享接口来自定义分享的地址、标题、描述、缩略图了。 分享到微信的时候遇到一个问题,就是第一次分享到微信里,是正确的,但是在微信打开分享的链接,再次分享的时候,发现小图片没了。 原因就是微信在你分享的时候,会自动给你分享的地址后面加入参数,导致你
阅读全文
ajax与WebAPI传参
摘要:1.GET请求传递参数 URL传参:http://localhost/ApiTest/test?id=1 API接收参数 [HttpGet] public string GetUser(int id) { return "User:" + id; } 传递JSON对象: $.ajax({ type:
阅读全文
jquery.validate.js客户端验证
摘要:参考:http://www.runoob.com/jquery/jquery-plugin-validate.html http://www.cnblogs.com/artech/archive/2012/06/17/client-validation-01.html 引用文件: <script t
阅读全文
jquery.form.js使用
摘要:API $("#formid").ajaxSubmit(); 或 $("#formid").submit(function(){ //提交表单 $(this).ajaxSubmit(); // 为了防止普通浏览器进行表单提交和产生页面导航(防止页面刷新?)返回false return false;
阅读全文
jquery获得/修改html标签
摘要:1.添加 meta$("head").append('<meta http-equiv="content-type" content="text/html;charset=gbk" />');修改 meta$("meta[http-equiv='content-type']").attr('cont
阅读全文
使用jsonp跨域发送请求
摘要:如果获取的数据文件存放在远程服务器上(域名不同,也就是跨域获取数据),则需要使用jsonp类型。 使用这种类型的话,会创建一个查询字符串参数 callback=? ,这个参数会加在请求的URL后面。 服务器端应当在JSON数据前加上回调函数名,以便完成一个有效的JSONP请求。 如果要指定回调函数的
阅读全文
jquery正则判断字符串有几个逗号
摘要:var angelweb="我,你,ta,";var re=/[,,]/g;if(re.test(angelweb)){ var n=angelweb.match(re).length; alert("字符串中包含"+n+"个逗号!"); }
阅读全文
对于某些浏览器不支持placeholder的解决办法
摘要:$(function () { if (!placeholderSupport()) { $('[placeholder]').focus(function () { var input = $(this); if (input.val() == input.attr('placeholder'))...
阅读全文
js无刷新提交表单
摘要:$("#form1").attr("target", "frameFile");$("#form1").submit();将表单提交目标指向隐藏的iframe,用iframe代替form提交
阅读全文
JS验证
摘要://邮箱验证function CheckEmail(str) { var re = /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/ if (re.test(str)) { return true; } else { return...
阅读全文
ajax访问当前页面后的 [WebMethod]描述的方法
摘要:脚本: function show() { $.ajax({ type: "post", async: false, contentType: "application/json", url: "/WebForm1.aspx/GetStr", data: '{"name":"txxx"}', dat
阅读全文
JS打开新窗口,子窗口操作父窗口
摘要:function ChangeParent() { $("#div_content", window.opener.document).text("test data!"); }
阅读全文