PDA

View Full Version : javascript



hemi
09-15-2009, 08:47 AM
table border=1width=300>
<tr><td width=150><strong>W<font size=1> j</font> </td><td width=75 align=center><strong>(gm)</td><td width=75 > <input type=text name=wj size=8 value='' id='wj'></td> </tr>
<tr><td><strong>W<font size=1>jp</font> </td><td align=center><strong>(gm)</td><td><input type=text name=wjp size=8 value='' id='wjp'> </td> </tr>
<tr><td><strong>Volume-ini</td><td align=center><strong>(gm)</td><td> <input type=text name=volumeini size=8 value='' id='v1' onblur='getContent("GET","schedulexist.php?wj="+document.getElementById("wj").value+"&wjp="+document.getElementById("wjp").value"&v1="+document.getElementById("v1").value,"s");'></td></tr>
<tr><td> <strong>Volume-7 taps</td><td align=center><strong>(gm)</td><td><input type=text name=volumetaps size=8 value='' id='v2' onblur='getContent("GET","scheduexist.php?wj="+document.getElementById("wj").value+"&wjp="+document.getElementById("wjp").value"&v1="+document.getElementById("v1").value+"&v2="+document.getElementById("v2").value,"t");'></td></tr>
</table>


<script language="javascript">
function validate()
{


var ccode,a,b;



ccode=window.document.reg.v2.value;
a=window.document.reg.wj.value;
b=window.document.reg.wjp.value;

var a1;

a1=(window.document.reg.wjp.value - window.document.reg.wj.value)/window.document.reg.v2.value
alert(a1);
reg.a1.value = (a1);



}
</script>


by this script iam getting a1 value in alert.but what i want is that it must come as normal text value in my table. Is it possible? if anyone knows help me out?

forum_amnesiac
09-15-2009, 10:46 AM
I've only had a quick look at this but you could try the following:


<td><span id="calcvalue">< /span>

add to your javascript :


document.getElementById('calcvalue').innerHTML = a1;