<link href="1.css" id="maincss" rel="stylesheet" type="text/css">
<input type="button" onClick="sets()" class="inputs" value="fasd54f6as4d56f4as56df456asd456as4df">
<input type="button" onClick="sets1()" class="inputs" value="fasd54f6as4d56f4asdf">
</body>
<script language="javascript">
function sets()
{
maincss.href="2.css"
}
function sets1()
{
document.styleSheets[0].href="1.css"
}
</script>

解决方案 »

  1.   

    window.reload;
    加上这句才能把更换后的效果显示出来吧。
      

  2.   

    多个CSS
    <link rel="stylesheet" type="text/css" href="style/1.css" title="CSS1" ID="CSS1">
    <link rel="stylesheet" type="text/css" href="style/2.css" title="CSS2" ID="CSS2" DISABLED>
    <link rel="stylesheet" type="text/css" href="style/3.css" title="CSS3" ID="CSS3" DISABLED>
    <link rel="stylesheet" type="text/css" href="style/4.css" title="CSS4" ID="CSS4" DISABLED>
    <script>
    function changeCss(id)
    {
    for (var i=1;i<5;i++)
    {
    if (i==id)
    document.getElementById("CSS"+i).disabled = false;
    else
    document.getElementById("CSS"+i).disabled = true;
    }
    }
    </script>
      

  3.   

    link rel="stylesheet" type="text/css" href="style/4.css" title="CSS4" ID="CSS4" DISABLED>
    <script>
    function changeCss(id)
    {
    for (var i=1;i<5;i++)
    {
    if (i==id)
    document.getElementById("CSS"+i).disabled = false;
    else
    document.getElementById("CSS"+i).disabled = true;
    }
    }
    </script>