ReferenceError:左侧无效赋值

alm*_*mix 1 javascript jquery fullcalendar

下一个代码有什么问题?它位于$ dialogContent.dialog中

buttons: {
                       save : function() {

                          calEvent.start = new Date(startdateField+' '+starttimeField.val());  // 11/25/2012 15:00
                          calEvent.end = new Date(endField.val());  
                          if($('#script_all_stores_false').attr('checked')) { /*clearChildren(document.getElementById('days'));*/ frequency_as_dayField.val() = 99; }
                        // ???? ?? ????????? ???? recurring_start, ?? ????????? ??? ??????? ????? ?????? ???????
                          if(recurring_startField.val()!='') calEvent.recurring_start = new Date(recurring_startField.val()); else calEvent.recurring_start = new Date(startdateField+' '+starttimeField.val());
                        // ???? ?? ????????? ???? recurring_end, ?? ????????? ??? ??????? ????? + 1??? (??????: ????? ???? ?? ???????? ? ?????????? ?????? ????, ????? ????????????? ??????????? ?? ?????? ????? ????? ??????? ? ???? ???????, ?? ???????? ?????? ?????)  
                          var startDate = new Date(startdateField+' '+starttimeField.val()); //calEvent.recurring_start;??
                            if(recurring_endField.val()!='') calEvent.recurring_end = new Date(recurring_endField.val());
                            else if(recurring_endField.val()=='' && $("#script_all_stores_true").is(":checked")/*&& recurring_startField.val()!=''*/) calEvent.recurring_end = new Date( startDate.setDate(startDate.getDate() + 365) );
                            calEvent.frequency_as_day = frequency_as_dayField.val();
var my_query_str = ''; 
                            $dialogContent.find("input[type='checkbox'][name='days']").each( function() { 
                                if(this.checked) { my_query_str += "&bookArray[]=" + 1; }
                                else { my_query_str += "&bookArray[]=" + 0; }
                            });

                          calEvent.days = my_query_str; 
                          calEvent.title = titleField.val();
                          calEvent.body = bodyField.val();
                          calEvent.teacher_id = teacherField.val();  
    ...
Run Code Online (Sandbox Code Playgroud)

萤火虫说:

ReferenceError: invalid assignment left-hand side
[Break On This Error]   

...e').attr('checked')) { /*clearChildren(document.getElementById('days'));*/ frequ...
Run Code Online (Sandbox Code Playgroud)

如果我改变frequency_as_dayField.val() = 99;var frequency_as_dayField = 99;

萤火虫说:

TypeError: frequency_as_dayField.val is not a function
[Break On This Error]   

calEvent.frequency_as_day = frequency_as_dayField.val();
Run Code Online (Sandbox Code Playgroud)

我在javascript中很糟糕,抱歉.请帮忙(

I H*_*azy 12

您需要传递一个值.val(),而不是为返回的值赋值.

if($('#script_all_stores_false').attr('checked')) {  
   /*clearChildren(document.getElementById('days'));*/ 
   frequency_as_dayField.val(99) /* = 99*/ ; 
         // good-------------^       ^-------------bad
}
Run Code Online (Sandbox Code Playgroud)