<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>18-3</title>
<script type="text/javascript">
//算数运算
function result() {
calc.display.value = eval(calc.display.value)
}
//退格操作
function backspace()
{
if( calc.display.value.length>1)
calc.display.value= calc.display.value.substring(0, calc.display.value.length - 1);
else
document.calc.display.value='';
}
//自定义factorial,进行阶乘计算
function factorial(n)
{
n=Math.abs(parseInt(n))
var fac=1 ;
for (;n>0;n-=1)
fac*=n ;
return(fac)
}
//阶乘运算
function n(x)
{
//调用factorial自定义函数
var a=factorial(x);
calc.display.value=(a);
}
//清空操作
function clearall()
{
calc.display.value='';
}
//计算正弦值
function Sin() {
var x = calc.display.value;
if (x==''||x==null)
alert('错误:没有输入数字');
else calc.display.value = Math.sin(degressToRadians(x));
}
//计算余弦值
function Cos() {
var x = calc.display.value;
if (x==''||x==null)
alert('错误:没有输入数字');
else calc.display.value = Math.cos(degressToRadians(x));
}
//计算正切值
function Tan() {
var x = calc.display.value;
if (x==''||x==null)
alert('错误:没有输入数字');
else calc.display.value = Math.tan(degressToRadians(x));
}
//计算反正弦
function Asin() {
var x = calc.display.value;
if (x==''||x==null)
alert('错误:没有输入数字');
else calc.display.value = Math.asin(degressToRadians(x));
}
//计算反余弦
function Acos() {
var x = calc.display.value
if (x==''||x==null)
alert('错误:没有输入数字');
else calc.display.value = Math.acos(degressToRadians(x));
}
//计算反正切
function Atan() {
var x = calc.display.value
if (x==''||x==null)
alert('错误:没有输入数字');
else calc.display.value = Math.atan(degressToRadians(x));
}
//转化为弧度数
function degressToRadians(degress)
{
return(degress*Math.PI/180)
}
//计算平方根
function Sqrt() {
var x = calc.display.value
if (x==''||x==null) alert('错误:没有输入数字');
else calc.display.value = Math.sqrt(x);
}
//计算ln
function Ln() {
var x = calc.display.value;
if (x==''||x==null) alert('错误:没有输入数字');
else calc.display.value=Math.log(x);
}
//计算log
function Log() {
var x = calc.display.value;
if (x==''||x==null) alert('错误:没有输入数字');
else calc.display.value=Math.log(x)*Math.LOG10E
}
//计算1/x
function Fraction() {
var x = calc.display.value;
if (x==''||x==null) alert('错误:没有输入数字');
else calc.display.value=1/x;
}
</script>
</head>
<body>
<form name="calc">
<table border=1 bgColor=#e6f2e7>
<tr align=middle>
<td><input style="font-size: 18px" readOnly size="25"
name=display><br>
</td>
</tr>
<tr>
<td align=" middle">
<table width="100%" border="1" >
<tr>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="seven" value="7"
onclick="calc.display.value +='7'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="eight" value="8"
onclick="calc.display.value +='8'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="nine" value="9"
onclick="calc.display.value +='9'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
onclick=backspace() type=button value="退 格"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
onclick="clearall()" type=button value="清 空"></td>
</tr>
<tr>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="four" value="4"
onclick="calc.display.value +='4'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="five" value="5"
onclick="calc.display.value +='5'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="six" value="6" onclick="calc.display.value +='6'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="pi" value="PI"
onclick="calc.display.value += '3.1415926535897932384626433832795'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="e" value="E"
onclick="calc.display.value += '2.718281828459045'"></td>
</tr>
<tr>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="one" value="1" onclick="calc.display.value +='1'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="two" value="2" onclick="calc.display.value +='2'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="three" value="3"
onclick="calc.display.value +='3'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="add" value="+" onclick="calc.display.value+='+'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="minus" value="-"
onclick="calc.display.value+='-'"></td>
</tr>
</tr>
<tr>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="zero" value="0"
onclick="calc.display.value +='0'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="point" value="."
onclick="calc.display.value+='.'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button value="n!" onclick="n(calc.display.value)"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="multiply" value="*"
onclick="calc.display.value+='*'"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="division" value="/"
onclick="calc.display.value+='/'"></td>
</tr>
<tr>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button value="sin" name="sin" onclick="Sin()"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="cos" value=" cos " onclick="Cos()"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="tan" value="tan" onclick="Tan()"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="(" value="(" onclick="calc.display.value += '('"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name=")" value=")" onclick="calc.display.value += ')'"></td>
</tr>
<tr>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="asin" value="asin" onclick="Asin()"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button value="acos" name="acos" onclick="Acos()"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button value="atan" name="atan" onclick="Atan()"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button value="1/x" onclick="Fraction()"></td>
<td><input
style="height: 30px; width: 45px; color: blue; line-height: 23px"
type=button name="p
没有合适的资源?快使用搜索试试~ 我知道了~
HTML,CSS,JavaScript 整合详解
共528个文件
html:256个
txt:250个
png:14个
4星 · 超过85%的资源 需积分: 10 8 下载量 176 浏览量
2009-11-10
12:32:30
上传
评论
收藏 1.1MB ZIP 举报
温馨提示
作者:王津涛 包含嵌套GOOGLE搜索代码
资源推荐
资源详情
资源评论
收起资源包目录
HTML,CSS,JavaScript 整合详解 (528个子文件)
mycss.css 126B
mycss.css 123B
Thumbs.db 72KB
18-3.html 9KB
18-2.html 2KB
5-4.html 2KB
5-3.html 2KB
16-29.html 2KB
content.html 2KB
8-8.html 1KB
8-9.html 1KB
18-1.html 1018B
7-18.html 931B
2-19.html 913B
7-19.html 899B
7-17.html 898B
7-16.html 839B
googleSearch.html 813B
7-13.html 769B
8-10.html 717B
4-6.html 705B
4-5.html 696B
14-7.html 695B
8-12.html 689B
7-15.html 684B
12-50.html 682B
7-14.html 679B
12-46.html 677B
7-12.html 665B
7-4.html 665B
7-5.html 665B
baiduSearch.html 660B
7-10.html 656B
17-3.html 654B
7-9.html 653B
12-47.html 653B
7-11.html 650B
7-8.html 648B
7-2.html 646B
16-24.html 646B
7-6.html 645B
7-3.html 644B
16-23.html 640B
16-4.html 637B
12-44.html 637B
7-7.html 635B
12-54.html 632B
12-19.html 630B
17-2.html 623B
7-1.html 619B
5-7.html 606B
4-7.html 599B
link.html 596B
8-6.html 592B
2-9.html 582B
8-5.html 582B
16-2.html 578B
4-9.html 577B
16-25.html 573B
12-42.html 570B
12-13.html 560B
12-33.html 555B
12-53.html 544B
left.html 540B
navigation.html 540B
12-40.html 537B
12-24.html 526B
12-37.html 526B
14-3.html 513B
14-11.html 513B
2-21.html 512B
12-16.html 510B
4-8.html 509B
12-23.html 506B
12-26.html 504B
16-8.html 502B
8-4.html 497B
8-3.html 497B
12-43.html 492B
12-48.html 490B
12-21.html 489B
12-3.html 487B
13-2.html 486B
6-16.html 485B
12-25.html 485B
14-4.html 480B
4-10.html 479B
13-8.html 479B
2-25.html 479B
16-10.html 479B
12-12.html 477B
12-38.html 476B
12-49.html 474B
12-39.html 472B
16-17.html 471B
4-11.html 471B
16-3.html 469B
17-1.html 468B
13-1.html 467B
9-3.html 466B
共 528 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
- xxjoy2012-04-09只是代码,可以作为初学的参考例子。
wanglaifu
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功