⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 04.htm

📁 javascript94个网页特效下载
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>
<head>
<title>计算器</title>
<meta http-equiv="目录类型" content="文本/html; 字符集=gb2312">
<style type="text/css">
<!--
a{font-style:normal;text-decoration:none;color:white}
a:hover {BACKGROUND:red;font-style:normal;text-decoration:none;color:yellow}
.white {  color: #FFFFFF}
table {  font-size: 9pt}
-->
</style>
</head>

<body bgcolor="#336699" topmargin="0" leftmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="font-size: 9pt;">
  <tr bgcolor="#336699"> 
    <td colspan="3" height="18">&nbsp; </td>
  </tr>
  <tr> 
    <td bgcolor="#336699" width="18"></td>
    <td align="center" bgcolor="#FFFFFF"> <br>
      <table width="56%" border="0" cellspacing="0" cellpadding="0" height="355">
        <tr> 
          <td rowspan="2" width="16" valign="top"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="white" style="FONT-SIZE: 11pt;">
              <tr bgcolor="#336699" bordercolor="#336699"> 
                <td style="BORDER-RIGHT: double; BORDER-TOP: double;  BORDER-LEFT: double; BORDER-BOTTOM: double;" height="70"><strong><a href="04.htm">演<br>
                  <br>
                  示</a></strong></td>
              </tr>
              <tr bordercolor="#009900" bgcolor="#009900"> 
                <td style="BORDER-RIGHT: double; BORDER-TOP: double; BORDER-LEFT: double; BORDER-BOTTOM: double" height="70"><strong><a href="04c.htm">源<br>
                  代<br>
                  码</a></strong></td>
              </tr>
            </table>
          </td>
          <td rowspan="2" width="8" bgcolor="#336699">&nbsp;</td>
          <td align="center" style="BORDER-RIGHT: double; BORDER-TOP: double; FONT-SIZE: 12pt; BORDER-LEFT: double; BORDER-BOTTOM: double" bordercolor="#336699" valign="top" height="335"><br>
            <b>计 算 器</b> 
            <hr width="92%" size="1" align="center">
            <table border=0 width="100%">
              <tr> 
                <td valign=middle align=center rowspan=2> 
                  <form name="keypad">
                    <center>
                      <font size="4" color="#66FF66"><b> 
                      <script language="JavaScript">
<!--
function round(val)

{

	return(Math.round(val*10000000)/10000000);

}



PI = 3.141592654;

function pie()

{

	document.keypad.display.value = PI;

}



function MakeArray(n){

	this.length=n;

   	for(var i=1; i<=n; i++) this[i]=0;

   return this

}

link = new MakeArray(5);



function enter(num)

{

	document.keypad.display.value += num;

}



function calculate(sign)

{

	var temp = document.keypad.display.value * 1;

	document.keypad.display.value = "";

	document.keypad.list.value = temp;

	link[1] = temp;



	if (sign == "/") {link[2] = "/"; document.keypad.list.value += " / ";}

	if (sign == "*") {link[2] = "*"; document.keypad.list.value += " * ";}

	if (sign == "-") {link[2] = "-"; document.keypad.list.value += " - ";}

	if (sign == "+") {link[2] = "+"; document.keypad.list.value += " + ";}

	if (sign == "p") {link[2] = "p"; document.keypad.list.value += " ^ ";}

}



function power()

{

	temp = 1;

	n = link[3];

   	for(var i=1; i<=n; i++) temp *= link[1];

	return(temp);

}



function equal()

{

	if (link[2]) {

		if (document.keypad.display.value != "") {



			var temp = document.keypad.display.value * 1;

			document.keypad.list.value += temp;

			link[3] = temp;



			if (link[2] == "/") {res = link[1] / link[3]; document.keypad.display.value = round(res)}

			if (link[2] == "*") {res = link[1] * link[3]; document.keypad.display.value = round(res)}

			if (link[2] == "-") {res = link[1] - link[3]; document.keypad.display.value = round(res)}

			if (link[2] == "+") {res = link[1] + link[3]; document.keypad.display.value = round(res)}

			if (link[2] == "p") {document.keypad.display.value = round( power() )}



			link[1]=0; link[2]=0; link[3]=0;

		}

	}

}



function calc(code)

{

	var temp = document.keypad.display.value * 1;



	if (code == 1) {temp1 = Math.sin(temp*PI/180); document.keypad.list.value = "sin "}

	if (code == 2) {temp1 = Math.cos(temp*PI/180); document.keypad.list.value = "cos "}

	if (code == 3) {temp1 = Math.tan(temp*PI/180); document.keypad.list.value = "tan "}

	if (code == 4) {temp1 = Math.sqrt(temp); document.keypad.list.value = "sqrt "}

	if (code == 5) {temp1 = Math.log(temp); document.keypad.list.value = "ln "}

	if (code == 6) {temp1 = 1/temp; document.keypad.list.value = "1/x, x="}

	if (code == 7) {temp1 = temp * temp; document.keypad.list.value = "x*x, x="}



	document.keypad.list.value += temp;

	document.keypad.display.value = round(temp1);

}



function fsolve()

{

	var a = document.keypad.c1.value*1;

	var b = document.keypad.c2.value*1;

	var c = document.keypad.c3.value*1;



	if (a==0) {document.keypad.list.value = "Not a Quadratic";

		     document.keypad.display.value = "Equation"}

	else { x1 = (b*b-4*a*c);

		if ( x1 < 0) {document.keypad.list.value = "Imaginary Roots";

				  temp = (Math.sqrt(Math.abs(x1)))/(2*a);

				  x2 = round(-b/(2*a)) + "+/- " + round(temp) + "i";

				  document.keypad.display.value = x2}

		else {

			var x1 = (-b + Math.sqrt(b*b-4*a*c)) / (2*a);

			var x2 = (-b - Math.sqrt(b*b-4*a*c)) / (2*a);



			document.keypad.list.value = "x1 = " + round(x1);

			document.keypad.display.value = "x2 = " + round(x2);

		}

	}

}



function change()

{

	var temp = document.keypad.display.value;



	if (temp.substring(0,1) == "-") {document.keypad.list.value = "";

						   document.keypad.display.value = 0 - document.keypad.display.value * 1}

	if (temp.substring(0,1) != "-") {document.keypad.list.value = "";

						   document.keypad.display.value = "-" + temp.substring(0,temp.length)}

}



function eraser()

{

	document.keypad.list.value = "Start Punching!";

	document.keypad.display.value = "";

	document.keypad.c1.value = "";

	document.keypad.c2.value = "";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -