Hi
Use following code
Javascript
function getValue(obj){
var divbox = document.getElementById(obj);
var returnvalue=0;
for(var i = 0 ;i < divbox.chilNodes.length;i++)
{
returnvalue += Number(divbox.childNodes[i].getAttribute("num"));
}
getElementById('id1').setAttribute('v',returnvalue);
}
HTML
<body önload="getValue('id1');">
<div id="id1" v="">
<p num="2"></p>
<p num="3"></p>
<p num="2"></p>
<p num="2"></p>
<p num="2"></p>
<p num="4"></p>
<button önclick="alert(document.getElementById('id1').getAttribute('v'))">Get Sum</button>
</div></body>
Thanks,
Imdadhusen