在 size_chart 扩展中使用以下代码时无法读取未定义 prototype.js 的 属性 'get'?

cannot read property 'get' of undefined prototype.js when using below code in size_chart extension?

我用的是size_chart扩展,phtml里面有代码,但是和原型js有冲突。这是产品视图页面上我的浏览器控制台中的错误。

prototype.js:5557 Uncaught TypeError: Cannot read property 'get' of undefined

下面是那个 phtml 上的 js 代码。

document.observe("dom:loaded", function () {
    Event.observe('sizechartbutton', 'click', showModal);
    var sizeChartObject = new sizeChart('sizechart_form');
    $('convertsizeunits').on('click', function (event) {
        sizeChartObject.changeUnits();
        Event.stop(event);
    });
    new Form.Observer('sizechart_form', 0.5, function () {
        sizeChartObject.findSize();
    });
});
var closeModal = function (e) {
    if (!e.target.descendantOf('sizechart')) {
        $('sizechartbox').removeClassName('_show');
        $('modals-overlay').remove();
    }
};
var showModal = function (event) {
    Event.stop(event);
    $('sizechartbox').addClassName('_show').setStyle({
        'z-index': '900'
    });
    $$('.modals-wrapper')[0].insert('<div id="modals-overlay" class="modals-overlay" style="z-index: 899;"></div>');
    Event.observe('sizechartbox', 'click', closeModal);
};

请检查"sizechartbutton"这个元素是否存在于你的page.Because它找不到你的元素。