JQuery 设置样式属性

来源:互联网 发布:linux压缩成zip 编辑:程序博客网 时间:2024/05/27 03:30


<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title></title>    <script src="scripts/jquery-1.7.1.min.js"></script>    <script>        $(function () {            //设置样式            //$('#btnShow').css('background-color', 'red');  //设置单个样式。$('#btnShow').css('background-color')  表示获取样式的值            //设置多个样式,多个样式之间用逗号隔开。            $('#btnShow').css({                'color': 'white',                'background-color': 'blue',                'font-size': '20px'            });        });    </script></head><body>    <input type="button" id="btnShow" value="显示" /></body></html>