本文介绍了js脚本仅在存在警报时才起作用-而不是ajax调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
OnClick事件调用以下datepicker函数.如果存在警报,则可以正常工作.否则,它不会显示所需的压光机.这是时间问题吗?
An OnClick event calls the following datepicker function. If an alert is present then, it works fine. Otherwise, it does not show the calender as required. Is this a timing issue?
function changeStartDate(Item){ alert ("alert goes here"); $("#datepicker_" + Item).datepicker({ dateFormat: 'M-dd-yy', onClose: function(dataText, inst){ newDate = dataText; processDateChange(newDate); }, }); flag = 1; }从何处调用
'<div class="InfoBoxLong" id="StartDate_' + TransactionOrderItemID + '"><input id="datepicker_' + TransactionOrderItemID + '" type="text" size="9" id="StartDate_' + TransactionOrderItemID + '" onClick="changeStartDate(\'' + TransactionOrderItemID + '\')" value="' + ActivationStartDate + '"> </input></div>' +推荐答案
可能日历日历DOM尚未完成渲染-添加alert()会阻塞页面,使该页面有时间完成渲染.使用等效的jquery.ready( docs.jquery/Events/ready# fn )呈现日历,然后仅在onclick事件上显示日历(而不是呈现日历).
Possible the calender DOM hasn't finished rendering - adding an alert() blocks the page which gives it time to finish rendering. Use the equivalent of jquery.ready (docs.jquery/Events/ready#fn) to render the calender and then only show it (rather than rendering it) on the onclick event.
更多推荐
js脚本仅在存在警报时才起作用
发布评论