javascript value getting
<p>I want to create a stock calculation system with javacript now i have create it there is some problem the problem is that i have created 3 rows 1.Purchase,2.Sold,3.Stock.Now i have set that when i give purchase value and sold quantity it will subtract and print value in stock text box and then is next column the stock value also prints in purcahse text box the problem is when the purchase item become nill means 0 so what can i do to add some quantity and start again this process.
the coding is.</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Stock Information&lt;/title&gt;
&lt;link rel="stylesheet" type="text/css" href="css/style.css"/&gt;
&lt;script type="text/javascript"&gt;
    //------------------------------------Date---------------------------------------------
    var today = new Date();                                                               //
    var dd = today.getDate();                                                             //
    var mm = today.getMonth()+1; //January is 0!                                          //
    var yyyy = today.getFullYear();                                                       //
    today = dd+'/'+mm+'/'+yyyy;                                                           //   
    document.write(today);                                                                //
    //-------------------------------------------------------------------------------------
//----------------------------------------------------  
function program(a,b,c,d,e,f)
{
    var total1=a-b;
    document.stock.t3.value=total1;

    var jump1=document.stock.t3.value;
    document.stock.t4.value=jump1;
    var total2= c-d;
    document.stock.t6.value=total2;

    var jump2=document.stock.t6.value;
    document.stock.t7.value=jump2;
    var total3= e-f;
    document.stock.t9.value=total3;
    }
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;center&gt;
&lt;h1 class="table"&gt;Stock Information&lt;/h1&gt;
&lt;/center&gt;
&lt;table width="800" align="center" class="table1"&gt;
  &lt;tr&gt;
    &lt;th width="260"class="table"&gt;Purchase&lt;/th&gt;
    &lt;th width="260"class="table"&gt;Sold&lt;/th&gt;
    &lt;th width="428"class="table"&gt;Stock&lt;/th&gt;
  &lt;/tr&gt;
  &lt;form name="stock"&gt;
  &lt;tr align="center"&gt;
    &lt;td&gt;&lt;input id="t1" type="text" style="width:260px;" class="input1"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input id="t2" type="text" style="width:260px;" class="input1"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input id="t3" type="text" style="width:260px;" class="input1" onClick="program(t1.value,t2.value)" readonly/&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr align="center"&gt;
    &lt;td&gt;&lt;input id="t4" type="text" style="width:260px;" class="input1" onClick="program(t1.value,t2.value,t4.value,t5.value)"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input id="t5" type="text" style="width:260px;" class="input1"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input id="t6" type="text" style="width:260px;" class="input1" onClick="program(t1.value,t2.value,t4.value,t5.value)" readonly/&gt;&lt;/td&gt;
  &lt;/tr&gt;
    &lt;tr align="center"&gt;
    &lt;td&gt;&lt;input id="t7" type="text" style="width:260px;" class="input1" onClick="program(value1.value,value2.value,t4.value,t5.value)"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input id="t8" type="text" style="width:260px;" class="input1"/&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input id="t9" type="text" style="width:260px;" class="input1" onClick="program(value1.value,value2.value,t4.value,t5.value,t7.value,t8.value)"readonly/&gt;&lt;/td&gt;
  &lt;/tr&gt;
 &lt;/form&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
