gpt4 book ai didi

javascript - 无法读取未定义的 magento 的属性 'length'

转载 作者:行者123 更新时间:2023-12-03 11:19:29 25 4
gpt4 key购买 nike

我正在尝试将日期选择器添加到magento 中的表单中。当我单击日历图像时,我在控制台中收到错误 -

Uncaught TypeError: Cannot read property 'length' of undefined

我在 calendar.js 的第一行代码中收到此错误:

for (i = 0; i < Calendar._MN.length; i++) {
a = a.replace(Calendar._MN[i], enUS.m.wide[i]);
}

这是代码:

<link type="text/css" rel="stylesheet" href="<?php echo $this->getJsUrl('calendar/calendar-win2k-1.css') ?>" /> 
<script src="<?php echo $this->getJsUrl('calendar/calendar.js')?>" ></script>
<script src="<?php echo $this->getJsUrl('calendar/calendar-setup.js')?>" ></script>

<script type="text/javascript">

jQuery(function(){
//<![CDATA[
Calendar.setup({
inputField : '_dob',
ifFormat : '%m/%e/%y',
button : '_dob_trig',
align : 'Bl',
singleClick : true
});
//]]>

});

</script>


<dl class="last">
<dt><label><?php echo $this->__('Date of birth') ?></label></dt>
<dd>
<div class="input-box">
<input style="width:40%;" name="dob[]" id="_dob" type="text" class="input-text" />
<img title="Select date" id="_dob_trig" src="<?php echo $this->getSkinUrl('images/calendar.gif');?>" class="v-middle">
</div>
</dd>
</dl>

谢谢

最佳答案

检查calendar/lang/calendar-en.js或您的calendar/lang/calendar-XX.js,其中XX是您的语言。那里似乎没有 Calendar._MN 数组;它必须是这样的数组:

Calendar._MN = new  
Array("January","February","March","April","May","June","July","August","September","October","November","December");

关于javascript - 无法读取未定义的 magento 的属性 'length',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27187247/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com