标签:
<!DOCTYPE html> <html> <head> <meta charset=‘utf-8‘> <title>test</title> <style src="text/css"> div{ width:80px; height:80px; position:absolute; left:100px; top:100px; background-color:red; } </style> <script src="js/jquery.js"></script> <script> window.onload = function(){ $(‘#btnok‘)[0].onclick = function(){ //1.获取元素的宽度和高度 //alert($(‘div‘).width()+‘-‘+$(‘div‘).height()); //2.设置元素的宽度和高度 $(‘div‘).width(200); $(‘div‘).height(200); } } </script> </head> <body> <input type="button" id="btnok" value="class属性设置" /> <hr /> <div></div> </body> </html>
标签:
原文地址:http://www.cnblogs.com/leigood/p/4908520.html