<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('#a').click(function(){
var sum=0;
$('.dt').each(function(){
sum=sum + parseInt($(this).val());
})
alert(sum);
});
});
</script>
</head>
<body>
<form>
<input type="text" class="dt" value="1"/>
<input type="text" class="dt" value="2"/>
<input type="text" class="dt" value="3"/>
<input type="text" class="dt" value="4"/>
</form>
<input type="button" id="a" value='alert'/>
</body>
</html>