drap5081683 2016-05-24 13:22
浏览 86
已采纳

使用javascript动态启用和禁用css文件?

I am very new to javascript. I am creating a multilingual website. It contains rtl and ltr languages. I have two css for those to languages. When user change his language I want to load respective css file. Is it possible in this way ? If not suggest any alternative way.

  • 写回答

1条回答 默认 最新

  • donglv9116 2016-05-24 14:28
    关注

    Is posible enable and disable css stylesheet with javascript. A example: http://plnkr.co/0exLXB

    function del_style() {
        document.getElementById("styles").disabled=true;
    }
    
    function add_style() {
        document.getElementById("styles").disabled=false;
    }
    

    I think you could adapt the code for your site

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?