mootools Fx.slide不工作IE6

时间:2010-06-21 14:38:11

标签: javascript internet-explorer-6 mootools

我有一些基于mootools构建的javascript,基本上给了div一些显示/隐藏功能。

window.addEvent('domready', function(){
/*var mySlide = new Fx.Slide('customise_text').hide()
var mySlide2 = new Fx.Slide('customise_link').hide()
$('customise').addEvent('click', function(e){
    $('customise').addClass('active');
    mySlide.toggle(); //show-hide login panel
    mySlide2.toggle(); //show-hide login panel
    e.preventDefault();
});*/

/*$('moodal_close').addEvent('click', function(){
    alert("1");
});*/
//alert("hello")
var vertical_slide = $('vertical_slide');
var checkoutVerticalSlide = $('vertical_slide_checkout');
var v_toggle_checkout = $('v_toggle_checkout');

if(!vertical_slide || !checkoutVerticalSlide || !v_toggle_checkout) {
    return;
} else {

    var status = {
        'true': 'open',
        'false': 'close'
    };
    //-vertical
    var myVerticalSlide = new Fx.Slide('vertical_slide').hide();
    $('v_toggle').addEvent('click', function(e){
        e.preventDefault();
        myVerticalSlide.toggle();
    });

    // When Vertical Slide ends its transition, we check for its status
    // note that complete will not affect 'hide' and 'show' methods
    myVerticalSlide.addEvent('complete', function() {
        if(status[myVerticalSlide.open] == 'open')
        {
            $('v_toggle').addClass('open');
        } else {
            $('v_toggle').removeClass('open');
        }
    });

    var checkout_status = {
        'true': 'open',
        'false': 'close'
    };

    var checkoutVerticalSlide = new Fx.Slide('vertical_slide_checkout').hide();
    $('v_toggle_checkout').addEvent('click', function(e) {
        e.preventDefault();
        checkoutVerticalSlide.toggle();
    });

    checkoutVerticalSlide.addEvent('complete', function() {
        if(status[checkoutVerticalSlide.open] == 'open')
        {
            $('v_toggle_checkout').addClass('open');
        } else {
            $('v_toggle_checkout').removeClass('open');
        }
    });
}

在IE6中,我收到页面加载错误并收到错误Object does not support this method or property

1 个答案:

答案 0 :(得分:1)

这可能是因为IE6不支持preventDefault方法。

如果您使用此方法(e.preventDefault()),请将呼叫替换为以下

if (e.preventDefault) { e.preventDefault(); } else { e.returnValue = false; }

看看它是否适合你:)

虽然能够支持所有浏览器感觉温暖和模糊,但IE6并不是一种温暖而模糊的浏览器。如果你想完全支持IE6,你会遇到问题,我担心。