<input type="button" id="b1" value="text" onclick="this.style.color='#FF0000';">

解决方案 »

  1.   

    document.getElementById("b1").style.color="red"
      

  2.   

    <script type="text/javascript">
        <!--
    function changeColor(oTarget)
    {
    if(oTarget.style.backgroundColor=='red'){
    oTarget.style.backgroundColor = 'yellow';
    }else{
    oTarget.style.backgroundColor = 'red';
    }
        
    }
        //-->
     </script>
        <input type="button" onclick="changeColor(this)" name="off" value="*0:OFF" class="bigbutton">
      

  3.   

    <script type="text/javascript">
        <!--
    function test()
    {
        document.getElementById("b1").style.color="#ff0000";
    }
        //-->
     </script>
    <input type="button" id="b1" value="text" onclick="test()" />