Div {width: 300 px; Height: 500 px; Border: 5 px; Background: # CCC; position:absolute; Left: 600 px; Top: 50 px; }
# TXT {width: 295 px; Height: 25 px; The text - align: right; }
# btn1 {width: 50 px; Height: 30 px; }
# btn2 {width: 50 px; Height: 30 px; float:right; }
Li {list - style: none; }
Li {float: left; Width: 30 px; height: 30px; Margin: 20 px; Background: # FFF. }
Li h4 {the font - size: 10 px; text-align:center; }
</style>
<script>
Window. The onl oad=function ()
{
Var oTxt=document. GetElementById (" TXT ");
Var oBtn1=document. GetElementById (" btn1 ");
Var oBtn2=document. GetElementById (" btn2 ");
Var oUl=document. GetElementById (" div ");
Var. ALi=oUl getElementsByTagName (" h4 ");
oTxt.value=https://bbs.csdn.net/topics/0;
OBtn1. Onclick=function ()
{
oTxt.value=https://bbs.csdn.net/topics/0;
}
for(var i=0; I
ALi [I] onclick=function ()
{
If (oTxt.value=https://bbs.csdn.net/topics/=0)
{
oTxt.value=https://bbs.csdn.net/topics/this.innerHTML;
}
The else
{
OTxt. Value +=this. InnerHTML;
}
Var STR=[aLi [9], aLi [11], aLi [12], aLi [13]].
Var sum1=0, sum2=0;
For (var j=0; J
STR [j] onclick=function ()
{
Sum1=parseInt (oTxt. Value);
OTxt. Value=' ';
ALi. [14] onclick=function ()
{
Sum2=parseInt (oTxt. Value);
If (STR [0])
{
oTxt.value=https://bbs.csdn.net/topics/sum1+sum2;
}
Else if (STR [1])
{
oTxt.value=https://bbs.csdn.net/topics/sum1-sum2;
}
Else if (STR [2])
{
oTxt.value=https://bbs.csdn.net/topics/sum1 * sum2;
}
Else if (STR [3])
{
oTxt.value=https://bbs.csdn.net/topics/sum1/sum2;
}
The else
{
OTxt. Value;
}
}
}
}
}
OBtn2. Onclick=function ()
{
OTxt. Value=https://bbs.csdn.net/topics/oTxt.value.replace ($/./., ' ')
}
}
}
</script>
The
The <body>
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
+
-
0
-
-
-
*
-
/
-
=