博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年9月3日

摘要: 注:经过验证,formValidator只适合一个页面不超过一个表单的情况。 本例实现功能:通过ajax提交表单,并在提交表单前对表单的数据进行验证。主要通过两个插件实现:第一个:jQuery Form Pluginhttp://jquery.malsup.com/form 主要功能是ajax提交表单第二个:jQuery formValidator 国产强大的表单验证插件。 http://www.cnblogs.com/wzmaodong 最简单的例子如下: <html> <head> <title>Form</title> <!-- 引入 阅读全文

posted @ 2012-09-03 14:21 oilsun 阅读(765) 评论(0) 推荐(0) 编辑

摘要: jQuery UI很强大,其中的日期选择插件Datepicker是一个配置灵活的插件,我们可以自定义其展示方式,包括日期格式、语言、限制选择日期范围、添加相关按钮以及其它导航等。官方地址:http://docs.jquery.com/UI/Datepicker,官方示例: http://jqueryui.com/demos/datepicker/。一个不错的地址,用来DIY jQuery UI界面效果的站点http://jqueryui.com/themeroller/DatePicker基本使用方法:<!DOCTYPEhtml><html><head>&l 阅读全文

posted @ 2012-09-03 14:15 oilsun 阅读(160) 评论(0) 推荐(0) 编辑

摘要: 摘要:jQuery的.bind()、.live()和.delegate()之间的区别并非总是那么明显的,然而,如果我们对所有的不同之处都有清晰的理解的话,那么这将会有助于我们编写出更加简洁的代码,以及防止在交互应用中弹出错误。 基本要素 DOM树 首先,可视化一个HMTL文档的DOM树是很有帮助的。一个简单的HTML页面看起来就像是这个样子: 事件冒泡(又称事件传播) 当我们点击一个链接时,其触发了链接元素的单击事件,该事件则引发任何我们已绑定到该元素的单击事件上的函数的执行。 $('a').bind('click', function() { alert(&q 阅读全文

posted @ 2012-09-03 14:11 oilsun 阅读(130) 评论(0) 推荐(0) 编辑

摘要: jquery的delegate有好几个缺憾。----或许是因为sizzle少提供了以refEl为参考、一个按selector来筛选els的filter(els,selector,refEl)的功能,jq需要自己去实现类似的功能。其一:selector是基于:root的,而不是:scope的。所以,在写代码时,需要带上scrope的定位部分。----注::root指document根节点,:scope指代理节点例如,代理div1的儿子,需要这样写:$('#div1').delegate('#div1>*','click',fun});而不是这 阅读全文

posted @ 2012-09-03 14:02 oilsun 阅读(140) 评论(0) 推荐(0) 编辑

摘要: Java代码 <script>jQuery("#grid_id").jqGrid({...colModel:[{name:'recommendation',index:'recommendation',width:100,align:"center",editable:true,formatter:'select',editoptions:{value:'0:未推荐;1:已推荐'}}...]...});</script>将数据库记录为0的格式化为“未推荐”, 记录为1 阅读全文

posted @ 2012-09-03 14:01 oilsun 阅读(194) 评论(0) 推荐(0) 编辑

摘要: //=========$(window).resize(function(){ $("#confTable").setGridWidth($(this).width()*.95); });原问题代码:??0 down vote favorite1I have a jqGrid at my web page. I have a resizing problem. When I restore down my web page, all the elements at my page resizes automatically however my jqGrid table d 阅读全文

posted @ 2012-09-03 14:00 oilsun 阅读(360) 评论(0) 推荐(0) 编辑

摘要: 1 down vote acceptedThere are some small problems which follow to the problem.The first problem. You should move the lines where you call navGrid and gridResize inside of success handler. So the navigator and the resizing element of the grid will be created after ther grid will be created.You uses r 阅读全文

posted @ 2012-09-03 13:57 oilsun 阅读(323) 评论(0) 推荐(0) 编辑

摘要: //返回CELL=[]的时候,提示 <script type="text/javascript"> //<![CDATA[ $(document).ready(function () { var grid = $('#oversight-sample'); var pages = []; // not as {}; var emptyMsgDiv = $('<div>No URLs have been loaded for evaluation.</div>'); grid.jqGrid... 阅读全文

posted @ 2012-09-03 13:55 oilsun 阅读(139) 评论(0) 推荐(0) 编辑

摘要: 遇到一个问题:表单输入框设置了文字,然后使用jQuery的焦点停留设置办法focus()进行处理。结果发现光标位置在firefox下停留的位置不对——停留在文字的最前边!只有IE浏览器下是正常的。这样的话肯定是不行的,于是想办法进行处理。终于找到了一些解决办法,效果如下代码有很多种,下面给出:方法一:function setSelectionRange(input, selectionStart, selectionEnd) { if (input.setSelectionRange) { input.focus(); input.setSelectionRange(select... 阅读全文

posted @ 2012-09-03 13:54 oilsun 阅读(1055) 评论(0) 推荐(0) 编辑

摘要: 1.定义函数/// /// C#日期比较计算两个日期的时间间隔 /// /// 第一个日期和时间 /// 第二个日期和时间 /// private string DateDiff(DateTime DateTime1, DateTime DateTime2) { string dateDiff = null; TimeSpan ts1 = new TimeSpan(DateTime1.Ticks); TimeSpan ts2 = new TimeSpa... 阅读全文

posted @ 2012-09-03 13:46 oilsun 阅读(4754) 评论(0) 推荐(0) 编辑