日期:2014-05-17  浏览次数:20476 次

求解!!请问怎么改变动态按钮的背景呢?
HTML code

 <div style="left: 20px; margin-left: 50px; width: 273px; height: 21px">
                    <input id="S_btn" style="width: 38px; height: 23px; cursor: hand;" title="点击选择" type="button" value="S"/>
                    <input id="M_btn" style="width: 37px; height: 23px; cursor: hand;" title="点击选择" type="button" value="M" />
                    <input id="L_btn" style="width: 37px; height: 23px; cursor: hand;" title="点击选择" type="button" value="L" />
                    <input id="XL_btn" style="width: 37px; height: 23px; cursor: hand;" title="点击选择" type="button" value="XL" />
                </div>



只是HTML里面的4个按钮,现在我想点击按钮的时候,按钮的背景图片为***.gif;按钮的边缘为1PX的实线,颜色为#ff8080,该怎么做呢?
谢谢

------解决方案--------------------
HTML code

    <div style="left: 20px; margin-left: 50px; width: 273px; height: 21px">
        <input id="S_btn" style="width: 38px; height: 23px; cursor: hand;" title="点击选择" type="button"
            value="S" onclick="setBackground(this)" />
        <input id="M_btn" style="width: 37px; height: 23px; cursor: hand;" title="点击选择" type="button"
            value="M" />
        <input id="L_btn" style="width: 37px; height: 23px; cursor: hand;" title="点击选择" type="button"
            value="L" />
        <input id="XL_btn" style="width: 37px; height: 23px; cursor: hand;" title="点击选择"
            type="button" value="XL" />
    </div>

    <script type="text/javascript">
        function setBackground(o) {
            o.style.border = 'dashed 1px #ff8080';
        }
    </script>