<html>
<head>
<script language="JavaScript">
function sumvalues()
{
var a=String(text1.value).split("+");
var v=new Number;
for (i=0;i<a.length;i++)
{
v+=Number(a[i]);
}
text1.value+="="+v.toString();
}
</script>
</head>
<body>
<input type="text" name="text1" value="2+2+3+4" length="20">
<input type="button" name="btn1" value="Sum" onclick="sumvalues()">
</body>
</html>
<FORM NAME=forma>
<INPUT TYPE="text" NAME="text1" value="" size="20"> <br>
<INPUT TYPE="button" NAME="knopka7" VALUE=" 7 " OnClick=copyfun7()>
<INPUT TYPE="button" NAME="knopka8" VALUE=" 8 " OnClick=copyfun8()>
<INPUT TYPE="button" NAME="knopka9" VALUE=" 9 " OnClick=copyfun9()>
<INPUT TYPE="button" NAME="knopka*" VALUE=" * " OnClick=copyfun10()><br>
<INPUT TYPE="button" NAME="knopka4" VALUE=" 4 " OnClick=copyfun4()>
<INPUT TYPE="button" NAME="knopka5" VALUE=" 5 " OnClick=copyfun5()>
<INPUT TYPE="button" NAME="knopka6" VALUE=" 6 " OnClick=copyfun6()>
<INPUT TYPE="button" NAME="knopka/" VALUE=" / " OnClick=copyfun11()><br>
<INPUT TYPE="button" NAME="knopka1" VALUE=" 1 " OnClick=copyfun1()>
<INPUT TYPE="button" NAME="knopka2" VALUE=" 2 " OnClick=copyfun2()>
<INPUT TYPE="button" NAME="knopka3" VALUE=" 3 " OnClick=copyfun3()>
<INPUT TYPE="button" NAME="knopka-" VALUE=" - " OnClick=copyfun12()><br>
<INPUT TYPE="button" NAME="knopkac" VALUE=" c " OnClick=copyfunc()>
<INPUT TYPE="button" NAME="knopka0" VALUE=" 0 " OnClick=copyfun0()>
<INPUT TYPE="button" NAME="knopka=" VALUE=" = " OnClick=copyfun13()>
<INPUT TYPE="button" NAME="knopka+" VALUE=" + " OnClick=copyfun14()>
</FORM>
<SCRIPT LANGUAGE="VBscript">
sub copyfun1
dim copytext
document.forma.text1.value=document.forma.text1.value+"1"
end sub
sub copyfun2
document.forma.text1.value=document.forma.text1.value+"2"
end sub
sub copyfun3
document.forma.text1.value=document.forma.text1.value+"3"
end sub
sub copyfun4
document.forma.text1.value=document.forma.text1.value+"4"
end sub
sub copyfun5
document.forma.text1.value=document.forma.text1.value+"5"
end sub
sub copyfun6
document.forma.text1.value=document.forma.text1.value+"6"
end sub
sub copyfun7
document.forma.text1.value=document.forma.text1.value+"7"
end sub
sub copyfun8
document.forma.text1.value=document.forma.text1.value+"8"
end sub
sub copyfun9
document.forma.text1.value=document.forma.text1.value+"9"
end sub
sub copyfun0
document.forma.text1.value=document.forma.text1.value+"0"
end sub
sub copyfun10
document.forma.text1.value=document.forma.text1.value+"*"
end sub
sub copyfun11
document.forma.text1.value=document.forma.text1.value+"/"
end sub
sub copyfun12
document.forma.text1.value=document.forma.text1.value+"-"
end sub
sub copyfun13
document.forma.text1.value=document.forma.text1.value+"="
end sub
sub copyfun14
document.forma.text1.value=document.forma.text1.value+"+"
end sub
sub copyfunc
document.forma.text1.value=""
end sub
</SCRIPT>
<FORM NAME=forma>
<INPUT TYPE="text" ID="text1" value="" size="20"> <br>
<INPUT TYPE="button" NAME="knopka7" VALUE=" 7 " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka8" VALUE=" 8 " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka9" VALUE=" 9 " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka*" VALUE=" * " OnClick=myHandler()><br>
<INPUT TYPE="button" NAME="knopka4" VALUE=" 4 " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka5" VALUE=" 5 " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka6" VALUE=" 6 " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka/" VALUE=" / " OnClick=myHandler()><br>
<INPUT TYPE="button" NAME="knopka1" VALUE=" 1 " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka2" VALUE=" 2 " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka3" VALUE=" 3 " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka-" VALUE=" - " OnClick=myHandler()><br>
<INPUT TYPE="button" NAME="knopkac" VALUE=" c " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka0" VALUE=" 0 " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka=" VALUE=" = " OnClick=myHandler()>
<INPUT TYPE="button" NAME="knopka+" VALUE=" + " OnClick=myHandler()>
</FORM>
<SCRIPT LANGUAGE="JavaScript">
function doSums()
{
var a=String(text1.value).split("+");
var v=new Number;
for (i=0;i<a.length;i++)
{
v+=Number(a[i]);
}
text1.value+="="+v.toString();
}
function myHandler()
{
document.getElementById("text1").value+=event.srcElement.name.substr(6);
}
</SCRIPT>
<html>
<head>
<SCRIPT LANGUAGE="VBScript">
sub myHandler
document.getElementById("text1").value=document.getElementById("text1").value+mid(window.event.srcElement.name,7)
end sub
sub mySum
a=split(document.getElementById("text1").value,"+",-1,1)
for i=0 to ubound(a)
v=v+csng(a(i))
next
document.getElementById("text1").value=document.getElementById("text1").value+"="+cstr(v)
end sub
</SCRIPT>
</head>
<body>
<FORM NAME=forma>
<INPUT TYPE="text" ID="text1" value="" size="20"> <br>
<INPUT TYPE="button" NAME="knopka7" VALUE=" 7 " OnClick="myHandler()">
<INPUT TYPE="button" NAME="knopka8" VALUE=" 8 " OnClick="myHandler()">
<INPUT TYPE="button" NAME="knopka9" VALUE=" 9 " OnClick="myHandler()">
<INPUT TYPE="button" NAME="knopka*" VALUE=" * " OnClick="myHandler()"><br>
<INPUT TYPE="button" NAME="knopka4" VALUE=" 4 " OnClick="myHandler()">
<INPUT TYPE="button" NAME="knopka5" VALUE=" 5 " OnClick="myHandler()">
<INPUT TYPE="button" NAME="knopka6" VALUE=" 6 " OnClick="myHandler()">
<INPUT TYPE="button" NAME="knopka/" VALUE=" / " OnClick="myHandler()"><br>
<INPUT TYPE="button" NAME="knopka1" VALUE=" 1 " OnClick="myHandler()">
<INPUT TYPE="button" NAME="knopka2" VALUE=" 2 " OnClick="myHandler()">
<INPUT TYPE="button" NAME="knopka3" VALUE=" 3 " OnClick="myHandler()">
<INPUT TYPE="button" NAME="knopka-" VALUE=" - " OnClick="myHandler()"><br>
<INPUT TYPE="button" NAME="knopkac" VALUE=" c " OnClick="document.getElementById('text1').value=''">
<INPUT TYPE="button" NAME="knopka0" VALUE=" 0 " OnClick="myHandler()">
<INPUT TYPE="button" NAME="knopka=" VALUE=" = " OnClick="mySum()">
<INPUT TYPE="button" NAME="knopka+" VALUE=" + " OnClick="myHandler()">
</FORM>
</body>
</html>
Сейчас этот форум просматривают: Yandex-бот и гости: 111