Document Object Model
<html>
<head>
<title>Shuma</title>
<script language="JavaScript">
function gjejshumen()
{
document.shumafrm.shuma.value=parseInt(document.shumafrm.nr1.value)+
parseInt(document.shumafrm.nr2.value);
}
function gjejshumen2()
{
var a,b,c;
a=document.getElementById('nr1');
b=document.getElementById('nr2');
c=document.getElementById('shuma');
c.value=parseInt(a.value)+parseInt(b.value);
}
</script>
</head>
<body>
<form name="shumafrm">
<p>Nr1:
<input name="nr1" type="text" id="nr1" value="" size="10" onChange="gjejshumen2();">
<br>
Nr2:
<input name="nr2" type="text" id="nr2" value="" size="10" onChange="gjejshumen2();">
<br>
Shuma:
<input name="shuma" type="text" id="shuma" size="10">
<br>
</p>
</form>
</body>
</html>
Shuma 2
<html>
<head>
<title>DOM</title>
<script language="JavaScript">
function shuma()
{
var a,b,c;
a=document.getElementById('nr1');
b=document.getElementById('nr2');
c=document.getElementById('sh');
c.value=parseInt(a.value)+parseInt(b.value);
}
function boshatis2()
{
document.myform.nr2.value='';
}
</script>
</head>
<body>
<form name="myform">
<p>Nr1: €
<input type="text" value="fut nr1" name="nr1" id="nr1" onClick="this.value='';" >
</p>
<p>Nr2:
<input name="nr2" type="text" id="nr2" onClick="boshatis2();"
value="futni numrin e dyte" size="10" maxlength="5">
<br>
<br>
Shuma:
<input name="sh" type="text" id="sh">
<br>
</p>
<p>
<input type="button" value="gjej shumen" onClick="shuma();" >
</p>
</form>
<br>
</body>
</html>