Change CSS style from javascript?

前端 未结 2 1827
谎友^
谎友^ 2021-01-24 23:40

I would prefer not to use jquery just for simplicity. I have three websites which one page cycles through. I want the webpages to be scaled each by a different scalar value. I t

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-25 00:27

    You need break statements to prevent the switch from falling through to the next statement.

    switch(i)
    {
    case 0:
      document.getElementById('frame').className = 'first';
      break;
    case 1:
      document.getElementById('frame').className = 'second';
      break;
    case 2:
      document.getElementById('frame').className = 'third';
      break;
    }      
    

提交回复
热议问题