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

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

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样