Tag: javascript

SlickGrid AJAX数据

我正在努力让AJAX与SlickGrid合作。 给出的示例是针对Digg的硬编码 。 此外,我不认为缓存在该示例中有效。 而且由于Digg的速率限制,很难真正了解它的工作原理。 如何设置SlickGrid以通过分页从我的数据库中获取数据。

过滤剑道模板中的来源

我有跟随Kendo模板和MVVM绑定。 这个模板的源代码是viewModel,里面有employees 。 员工集合中有3条记录。 我只需要显示IsSelected属性为true的记录。 employees: [ { name: “Lijo”, age: “28”, IsSelected: true }, { name: “Binu”, age: “33”, IsSelected: false }, { name: “Kiran”, age: “29”, IsSelected: false } ] 题 我们如何在模板中指定此过滤? 码 Template Filtering $(document).ready(function () { kendo.bind($(“body”), viewModel); }); var viewModel = kendo.observable({ employees: [ { name: “Lijo”, age: “28”, IsSelected: […]

javascript – 全屏

if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { if (document.documentElement.requestFullscreen) { document.documentElement.requestFullscreen(); } else if (document.documentElement.msRequestFullscreen) { document.documentElement.msRequestFullscreen(); } else if (document.documentElement.mozRequestFullScreen) { document.documentElement.mozRequestFullScreen(); } else if (document.documentElement.webkitRequestFullscreen) { document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT); } } else { if (document.exitFullscreen) { document.exitFullscreen(); } else if (document.msExitFullscreen) { document.msExitFullscreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitExitFullscreen) […]

jQuery Validation插件,IE7“SCRIPT3:找不到成员”

我有以下内容: Name of Course: Reporting Year: Select option… 2013-2014 2012-2013 2011-2012 2010-2011 $(function(){ jQuery.validator.addMethod(“notEqual”, function(value, element, param) { return this.optional(element) || value !== param; }, “Please select an option”); $(‘form’).validate({ rules:{ ‘reporting_year’: { notEqual: “-1” } } }); }); 每个人最喜欢的浏览器,IE7(IE10 w /兼容性)在控制台中报告以下错误: SCRIPT3:找不到会员。 jquery.js,第2525行,第4行 当然IE8及以上版本工作正常,但我的客户端正在使用IE7。

仅在某些屏幕分辨率下包含php文件

我在响应式设计方面遇到了问题。 我找到的一个解决方案是,如果窗口尺寸不够大,根本不加载它们。 所以我想我会用广告代码,容器等创建一个单独的php文件……而不是将它包含在页面上。 但是,如果窗口宽度为720px或更高,我不知道如何只包含此文件,否则不包含此文件。 也许,javascript可以用某种方式,不知道它将如何适用于所有的dom和PHP包括虽然。

如何在导致模糊的点击事件后触发Javascript模糊事件?

我曾经遇到过这个问题几次,我对以前用过的解决方案不满意。 我有一个带有模糊事件的输入框,可以validation它的内容,还有一个按钮,可以在点击时填充输入框。 问题是单击按钮会触发输入模糊事件,然后触发按钮单击事件,因此按钮插入的内容不会被validation。 见http://jsfiddle.net/jakecr/dL3K3/ 我知道这是正确的行为,但我想不出一个彻底解决问题的方法。

如何使用jQuery Deferred with custom events?

我有两个抽象的进程(例如在js对象中使用不暴露其内部的暴露模块模式进行管理),它们在完成时触发自定义事件 。 我想在两个自定义事件都被触发时执行操作。 jQuery 1.5中新的Deferred逻辑似乎是一种管理它的理想方法,除了when()方法接受返回promise()的Deferred对象(或正常的js对象,但是当()立即完成而不是等等,这对我来说毫无用处)。 理想情况下,我想做的事情如下: //execute when both customevent1 and customevent2 have been fired $.when(‘customevent1 customevent2’).done(function(){ //do something }); 将这两种技术结合起来的最佳方法是什么?

如何在页面导航后跟踪手风琴(在母版页中)打开状态?

我正在使用jquery手风琴作为asp.net主页中的菜单。 这是jquery $(document).ready(function() { $(“.header”).click(function() { $(this).toggleClass(“display”); $(this).next(“div .menu_body”).slideToggle(500); }); }); 这是HTML。 Header-1 Link-1 Header-2 Link-2 Header-3 Link-3 根据上面的代码,当单击标题时,内容(menu_body)将滑动切换。 menu_body默认隐藏,当用户单击标题时,menu_body可见。 示例问题:例如:2 menu_body可见,当我点击href =“https://stackoverflow.com/questions/6039343/how-to-keep-track-of-accordionin-masterpage-open-status-after-page-navigation/page1.aspx”时,页面将被导航到https://stackoverflow.com/questions/6039343/how-to-keep-track-of-accordionin-masterpage-open-status-after-page-navigation/page2.aspx但是手风琴将返回默认值,其中所有menu_body都被隐藏。 由于我在母版页中使用此手风琴,因此无法存储值以在页面导航时将手风琴menu_body状态跟踪到隐藏字段中。 隐藏字段中的值将被重置。 我想将此存储在会话中,但在客户端页面中,它不允许我们将值存储到会话中。 对此有何解决方案?

JQuery URLvalidation器

所有, 我正在尝试使用JQuery的URL Validator插件。 http://docs.jquery.com/Plugins/Validation/Methods/url 我有一个带有URL的文本框。 我想编写一个获取文本框值的函数,使用jquery的validation器插件来validationURL并返回true或false。 像Ex这样的东西: function validateURL(textval) { // var valid = get jquery’s validate plugin return value if(valid) { return true; } return false; } 我希望这是一个可重复使用的function.. 谢谢

Javascript按代码添加js库

我正在尝试将我的长JavaScript代码拆分到不同的库中。 我正在尝试编写一个包装器脚本来加载我的所有库: //this file loads all the scripts to the page $(document).ready(function(){ var fileName = getCurrentFileName(); loadScript(“scripts/pico/popups.js”); loadScript(“scripts/pico/effects.js”); loadScript(“scripts/pico/pico.js”); loadScript(“scripts/pico/facebook.js”); if (fileName != null) loadScript(“script/pico/” + fileName + “.js”); }); /** * Load a script to the body element * @param name the name of script file.js */ function loadScript(name){ // Adding the script tag […]