随笔 - 233  文章 - 0  评论 - 246  阅读 - 84万
01 2014 档案
Knockout: radio选项切换引发click事件的一点总结
摘要:1.场景:如下图,当选择定期存款时,输入框右边出现红色的必输项星号,当选择活期存款时,不再出现该星号。2.思路一:不使用knockout,直接用click事件,就可以实现这个需求,代码如下: 活期存款 定期存款 定期几年:年 * 3.思路二:使用Knockout的click事件及监控属性.代码如下:htm 活期存款 定期存款 定期几年:年 *jsrequire.config({ paths: { "knockout": "../lib/knockout/knockout-2.3.0", "jquery": "../lib/j 阅读全文
posted @ 2014-01-14 23:52 BobLiu 阅读(11093) 评论(3) 推荐(1) 编辑
Knockout与Require框架同时使用时的visible绑定的问题,造成的影响,以及解决的方法。
摘要:Knockout 可以将 visible 绑定到DOM 元素上,使得该元素的hidden 或visible 状态取决于绑定的值。查看以下knockout的描述,http://knockoutjs.com/documentation/visible-binding.htmlWhen the parameter resolves to a false-like value (e.g., the boolean value false, or the numeric value 0, or null, or undefined), the binding sets yourElement.styl. 阅读全文
posted @ 2014-01-08 11:03 BobLiu 阅读(2061) 评论(3) 推荐(1) 编辑
常用代码之八:setTimeout 和 clearTimeout。
摘要:1.先写一个错误的例子: function DealSomething() { //write some code window.setTimeout(function () { alert("已经等待超过10分钟,自动关闭页面。"); }, 600000); }这个例子的行为:不管是否处理完,超过10分钟后,都弹出这个alert框来。2.再看另一个错误的例子,这次使用了clearTimeout函数来清除setTimeout。 function DealSomething() { //write some code var Timer =window.setTimeout( 阅读全文
posted @ 2014-01-07 21:32 BobLiu 阅读(816) 评论(0) 推荐(0) 编辑


点击右上角即可分享
微信分享提示