1,2看不懂你的需求,绕来绕去的
3、
<script>
var a=10;
var b=3;
alert(Math.round((a*100)/b)/100);
</script>

解决方案 »

  1.   

    看不明白。
    1、如果cc是公式的字符串的话,可以obj3.innerText=eval(cc)
      

  2.   

    可能我没有说清楚,
    有表格
    pro_id pro_name pro_price pro_sum 
      1      苹果     1.50     10
      2      西瓜     0.78      20
      ..     ...       ....     ...
    得到总计:
     相当于:1.50*10+0.78*20+...
      

  3.   

    <html>
    <head>
    <script language=javascript>
    function a(){
    alert((10/3).toFixed(2));
    var price=10;
    var cc=document.getElementById("txtformula");
    var t=document.getElementById("total");
    var total=eval(cc.value);
    t.innerText=total;
    alert(total);
    }

    function b(){

    }
    </script>
    </head>
    <body>
    <input type=text id="txtformula" value="price*1.5">
    <input type=text id="total" >
    <input type=button onclick="a();" value="compute"></body>
    </html>
      

  4.   

    var cc=eval(document.getElementById("txtformula").value);
      

  5.   

    回:mbx615(白天鬼混挣钱,晚上挣钱鬼混)
      谢谢你:刚才试了一下,没有反应.