<pre>
(((1+2)+3)*10-(3-1)))/10
(((1+2)+3)*10-(3-1))/10
</pre>
<br />
<span id="result"> </span><p><input type="text" name="l" id="rad1"><input type="button" onclick="rep()" value="Подсчитать"/></p>
<script type="text/javascript">
function rep (){
var a = document.getElementById('rad1').value;
var c=a;
var b=true;
while (a.search(/[\(\)]/g)!= -1&&b) {
a = a.replace(/\([^\(\)]+\)/g,'$');//alert(a)
b = a.split(/\(|\)/).length!=2 && a.replace(/\(\)/g,'')==a;
}
if(b){b=eval(c.replace("=",""));}
document.getElementById('result').innerHTML=b;
}
</script>