Calling javascript functions from drop down

前端 未结 2 1368
甜味超标
甜味超标 2021-01-06 15:59

I have this HTML code at the moment:

Theme
  • Choose theme
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-06 16:25

    
    
    document.getElementById("myList").onchange = function() {
       var sheet=document.getElementById("myList").value;
    
       if(sheet=="one"){
       setActiveStyleSheet("theme1");
       }
       else if(sheet=="two"){
       setActiveStyleSheet("theme2");
       }
       else if(sheet=="three"){
       setActiveStyleSheet("theme3");
       }
       else{
       setActiveStyleSheet("default");
       }
       return false
    };
    

提交回复
热议问题