开发者

onclick event show the calendar for the previous image

is this code is ok

This is a part of code

create_table.find("#f_trigger_c").each(function(){
            var oclk = " displayCalendar(document.prjectFrm['"+ ia +"dtSubDate'],'yyyy-mm-dd', this)";
        开发者_开发百科    var newclick = new Function(oclk);
            jq(this).click(newclick);
      });

Please help me.


This would be an improvement:

create_table.find("#f_trigger_c").each(function() {
    jq(this).click(function() {
        displayCalendar(document.prjectFrm[ia + "dtSubDate"], 'yyyy-mm-dd', this);
    });
});

When possible, you should declare a function:

Function objects created with the Function constructor are parsed when the function is created. This is less efficient than declaring a function and calling it within your code, because functions declared with the function statement are parsed with the rest of the code.

https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜