我想在一个变量中计算或添加所有框宽度的宽度。我应该使用循环或类似的东西。请建议
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
.container {
width: 610px;
overflow: hidden;
position: relative;
height: 300px;
}
.con { position:absolute; left:0; width:2000px}
.box { float:left; width:200px;
height:200px; margin-right:5px;
background:#F00; margin-top:5px;}
</style>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
$(function (){
$('a').click(function (){
alert($('.box').width())
})
})
</script>
</head>
<body>
<div class="container">
<div class="con">
<div class="box">df</div>
<div class="box">adfa</div>
<div class="box">asdf</div>
</div>
</div>
<a href="#">click</a>
</body>