2

I keep getting this error and my lack of JS knowledge is not helping.

I ripped this code from another post.

function showPopup(sUrl, id) {
    oPopup = new Window({
        id: id,
        className: 'magento',
        url: sUrl,
        width: awidth,
        height: aheight,
        minimizable: false,
        maximizable: false,
        showEffectOptions: {
            duration: 0.4
        },
        hideEffectOptions: {
            duration: 0.4
        },
        destroyOnClose: true
    });
    oPopup.setZIndex(100);
    oPopup.showCenter(true);
}

document.observe("dom:loaded", function () {
    $$('button selector')[0].observe('click', function (oEvent) {
        showPopup($(this).readAttribute('href'));
        Event.stop(oEvent);
    });
});

I tried assigning the id as well. where id: 'theid'

document.observe("dom:loaded", function() {
    $$('theid')[0].observe('click', function(oEvent) {
        showPopup($(this).readAttribute('href'));
        Event.stop(oEvent);
    });
});

The pop up works I'm using this function for compare and the newsletter but I can't get rid of the error. I modified the function a bit but this is the original code. More specifically I'm using prototype/window.js with the magento css theme.

3

I modified the popup code, this worked for my needs.

function addNewPop(id,title,w,h){
win = new Window({
    title: title,
    className:"magento",
    destroyOnClose: true, 
    recenterAuto:false, 
    width:w,
    height:h,
    id: title,
    minimizable: false,
    maximizable: false,
    showEffectOptions: {
        duration: 0.4
    },
    hideEffectOptions:{
        duration: 0.4,
    }
});
win.setZIndex(100);
win.showCenter(true);
win.setContent(id, false, false);
//hide div on close
$(title + '_close').observe('click', function(event) {
    $(id).setStyle({display: 'none'});
});

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.