相关疑难解决方法(0)

我可以在JavaScript的不同for循环中声明两次相同的变量吗?

可能重复:
JavaScript变量范围

我有一个用于HTML选择选项的JavaScript函数:

// Show and hide days according to the selected year and month.
function show_and_hide_days(fp_form) {
    var select_year= $(fp_form).find("select.value_year");
    var select_month= $(fp_form).find("select.value_month");
    var select_day= $(fp_form).find("select.value_day");
    var selected_year= $.parse_int($(select_year).val());
    var selected_month= $.parse_int($(select_month).val());
    var selected_day= $.parse_int($(select_day).val());
    var days_in_month= new Date(selected_year, selected_month, 0).getDate();
    // If the number of days in the selected month is less than 28, change it to 31.
    if (!(days_in_month >= 28))
    {
        days_in_month= 31;
    }
    // If the selected day is bigger than the number of days …
Run Code Online (Sandbox Code Playgroud)

javascript variables var declare

29
推荐指数
2
解决办法
6051
查看次数

标签 统计

declare ×1

javascript ×1

var ×1

variables ×1