至少有两个错误:
1. 文本框没有 onkeyup 事件
2. 文本框的 name 与你自定义的函数同名, 系统无法正确得知你调用的是控件还是函数<script language="JavaScript">
function total2(form)
{
    setTimeout("document.all.price.innerText = document."+ form.name +".total.value");
}
</script>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
  <table width="100%" border="1" cellspacing="0" cellpadding="0">
    <tr>
      <td width="44%">
        <input type="text" name="total" onkeydown="total2(this.form)"> 
      </td>
      <td width="56%">
        <div id="price">&nbsp;</div>
      </td>
    </tr>
      </table>
</form>

解决方案 »

  1.   

    纠正你一个错误,文本框有 onkeyup 事件
      

  2.   

    如果象下面,price是变量的话,document.all.price.innerText中的price怎麽写??
    <script language="JavaScript">
    function total(form,i){
    total="total"+i
    price ="price"+i
    document.all.price.innerText=form.total.value
    }
    </script><body bgcolor="#FFFFFF" text="#000000">
    <form name="form1" method="post" action="">
      <table width="100%" border="1" cellspacing="0" cellpadding="0">
        <tr>
          <td width="44%">
            <input type="text" name="total1" onkeyup="total(this.form,1)"> 
          </td>
          <td width="56%">
            <div id="price1">&nbsp;</div>
          </td>
        </tr>   <td width="44%">
            <input type="text" name="total2" onkeyup="total(this.form,2)"> 
          </td>
          <td width="56%">
            <div id="price2">&nbsp;</div>
          </td>
        </tr>      </table>
    </form>
      

  3.   

    如果象下面,price是变量的话,document.all.price.innerText中的price怎麽写??
    <script language="JavaScript">
    function total(form,i){
    total="total"+i
    price ="price"+i
    document.all.price.innerText=form.total.value
    }
    </script><body bgcolor="#FFFFFF" text="#000000">
    <form name="form1" method="post" action="">
      <table width="100%" border="1" cellspacing="0" cellpadding="0">
        <tr>
          <td width="44%">
            <input type="text" name="total1" onkeyup="total(this.form,1)"> 
          </td>
          <td width="56%">
            <div id="price1">&nbsp;</div>
          </td>
        </tr>   <td width="44%">
            <input type="text" name="total2" onkeyup="total(this.form,2)"> 
          </td>
          <td width="56%">
            <div id="price2">&nbsp;</div>
          </td>
        </tr>      </table>
    </form>
      

  4.   

    <input onkeyup="alert('为什么这个事件不会被触发??')">
    所以说楼主, 你不能用 onkeyup 这个事件了
      

  5.   

    <script language="JavaScript">
    function total(form,i)
    {
      setTimeout("document.all.price"+i+".innerText = document."+ form.name +".total"+i+".value");
    }
    </script><body bgcolor="#FFFFFF" text="#000000">
    <form name="form1" method="post" action="">
      <table width="100%" border="1" cellspacing="0" cellpadding="0">
        <tr>
          <td width="44%">
            <input type="text" name="total1" onkeydown="total(this.form,1)"> 
          </td>
          <td width="56%">
            <div id="price1">&nbsp;</div>
          </td>
        </tr>   <td width="44%">
            <input type="text" name="total2" onkeydown="total(this.form,2)"> 
          </td>
          <td width="56%">
            <div id="price2">&nbsp;</div>
          </td>
        </tr>      </table>
    </form>