TypechoJoeTheme

香草物语

统计
登录
用户名
密码
/
注册
用户名
邮箱
输入密码
确认密码
搜索到 10 篇与 的结果
2018-01-24

jQuery post打开窗口并传递数据

jQuery post打开窗口并传递数据
有时候,在项目中,我们为了隐藏URL,可以通过post的方式打开一个新的窗口,并将数据post到新的网页。以下代码通过一个隐藏的form标签,实现post打开新窗体功能。function openBlank(action,data,n){ var form = $("<form/>").attr('action',action).attr('method','post'); if(n) form.attr('target','_blank'); var input = ''; $.each(data, function(i,n){ input += '<input type="hidden" name="'+ i +'" value="'+ n +'" />'; }); form.append(input).appendTo("body").css...
Laughing
2018-01-24

Web前端

1,124 阅读
0 评论
2018年01月24日
1,124 阅读
0 评论
2017-11-02

Jquery.cookie的使用

Jquery.cookie的使用
在原始的JavaScript中,我们可以通过document.cookie的方式获取cookie,但是由于cookie是字符串,所以当有多个值时,我们需要通过split方法进行截取。除此之外,我们可以通过正则表达式的方式通过名称获取cookie,但是正则表达式不容易阅读,起码我是这么认为的。为了方便读取或者设置cookie,我们可以引用jQuery.cookie插件。安装插件jQuery.cookie的下载地址,大家可以直接去网上下载,引用方法也非常简单,直接引用一个js即可,如下<script src="~/lib/jquery-cookie/jquery.cookie.js" type="text/javascript"></script>使用jQuery.cookie获取cookieif ($.cookie("UserName") != undefined) { $("#RememberMe").attr('checked', 'checked'); } 设置cookie$.co...
Laughing
2017-11-02

Web前端

1,187 阅读
0 评论
2017年11月02日
1,187 阅读
0 评论
2017-07-31

js实现浏览器全屏以及退出全屏

js实现浏览器全屏以及退出全屏
东西很简单,直接上代码/* * 全屏 */ function fullScreen(ele) { var fullScreenEnabled = document.fullScreenEnabled || document.webkitFullScreenEnabled || document.mozFullScreenEnabled || document.msFullScreenEnabled; var isFullScreen = document.fullScreenElement || document.webkitFullScreenElement || document.mozFullScreenElement || document.msFullScreenElement; if (fullScreenEnabled === undefined || fullScreenEnabled) { ...
Laughing
2017-07-31

Web前端

1,114 阅读
0 评论
2017年07月31日
1,114 阅读
0 评论
2017-06-30

jquery checkbox勾选/取消勾选第二次无效的问题

jquery checkbox勾选/取消勾选第二次无效的问题
代码如下$("#rdIsStop").attr('checked', result.isStop == '0' ? false : true); 问题描述这段代码,第一次执行的时候,没有任何问题,但是第二次以后再执行,你会发现不起作用。问题分析最近在iteye的新闻中看到jQuery已经更新到了1.6.1。和之前版本的最大变化是增加了.prop方法。但是.prop()方法和.attr()方法,单从字面上很难区分。在汉语中properties和attributes都有表示“属性”的意思。下面根据这篇博文(javascript:mctmp(0);),简要翻译了.prop()和.attr()的用法:从1.5.2升级到1.6.1通过介绍新方法.prop()以及.attr()方法的改变,jQuery1.6.1引起了一场关于attributes和properties之间有何区别和联系的激烈讨论。同时,1.6.1也解决了一些向后兼容性问题。当从1.5.2升级到1.6.1时,你不必修改任何attribute代码。下面是关于jQuery1.6和1.6.1中Attributes...
Laughing
2017-06-30

Web前端

1,082 阅读
0 评论
2017年06月30日
1,082 阅读
0 评论
2017-06-30

jquery easyui tabs切换问题

jquery easyui tabs切换问题
问题描述tab如果存在多个标签时,如果不关闭第一个标签,再打开第二个或者第三个。。。标签后,重新切换到第一个标签,结果第一个标签总是显示最后一个标签的内容。问题代码$.each(_menus.menus, function (i, n) { menulist += "<ul>"; $.each(n.menus, function (j, o) { menulist += "<li><div><a target='mainFrame' href='" + o.url + "'>" + '<span data-options="iconCls:\'icon-save\'"></span>' + o.menuname + "</a></div></li> "; }) menulist ...
Laughing
2017-06-30

Web前端

1,072 阅读
0 评论
2017年06月30日
1,072 阅读
0 评论
2017-06-30

扩展jQuery实现金额千分位计数

扩展jQuery实现金额千分位计数
实现代码 /* * @character_set UTF-8 * @author Jerry.li(hzjerry@gmail.com) * @version 1.2014.08.24.2143 * Example * <code> * alert($.formatMoney(1234.345, 2)); //=>1,234.35 * alert($.formatMoney(-1234.345, 2)); //=>-1,234.35 * alert($.unformatMoney(1,234.345)); //=>1234.35 * alert($.unformatMoney(-1,234.345)); //=>-1234.35 * </code> */ (function($) { $.extend({ /** * 数字千分位格式化 * @pub...
Laughing
2017-06-30

Web前端

1,087 阅读
0 评论
2017年06月30日
1,087 阅读
0 评论
2017-06-30

Jquery获取checkbox属性checked为undefined

Jquery获取checkbox属性checked为undefined
jQuery官方文档As of jQuery 1.6, the .attr() method returns undefined for attributes that have not been set. In addition, .attr() should not be used on plain objects, arrays, the window, or the document. To retrieve and change DOM properties, use the .prop()method.jQuery版本变化v1.6以后attr(‘checked’)就返回checked和undefined, v1.6以前返回true和false, v1.6以后可以使用is(':checked')或者.prop('checked')来返回true和false
Laughing
2017-06-30

Web前端

1,281 阅读
1 评论
2017年06月30日
1,281 阅读
1 评论
2017-06-30

WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping

WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping
症状WebForms UnobtrusiveValidationMode 需要“jquery”ScriptResourceMapping。请添加一个名为 jquery (区分大小写)的 ScriptResourceMapping。解决办法在webconfig中找到<appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> <add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms" /> </appSettings> 删除即可。在网站根目录下新建一scripts文件夹,向里边添加jquery-1.7.2.min.js和jquery-1.7.2.js(可根据自己需要使用不同的版本),在根目录下添加全局应用程序类Global....
Laughing
2017-06-30

Java

1,012 阅读
0 评论
2017年06月30日
1,012 阅读
0 评论
2017-01-01

TypeError: url.indexOf is not a function

TypeError: url.indexOf is not a function
问题在使用 jquery 3.3.1 版本时,写了如下测试代码: <script> $(window).load(function(){ console.log("just a test!"); }); </script>运行出错:TypeError: url.indexOf is not a function ..........原因:.load() , .error() , .unload() ,已经不再支持,jquery1.8版本之后的都无法再使用。解决办法使用.on("load",function(){.................}) 来代替.load() 即可。
Laughing
2017-01-01

Web前端

1,197 阅读
0 评论
2017年01月01日
1,197 阅读
0 评论