Javascript网页计算器
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>网页计算器</title>
<style type="text/css">
#container
{
width: 432px;
margin: 0 auto;
text-align: center;
height: 324px;
}
div
{
text-align: left;
width: 400px;
}
input
{
height: 37px;
width: 93px;
margin-bottom: 10px;
background: #CA0;
font-size: 30px;
}
input#answer
{
height: 37px;
width: 381px;
color: #FFF;
font-size: 35px;
text-align: right;
background: #38B;
}
input#equ
{
height: 37px;
width: 190px;
}
input#rst
{
height: 37px;
width: 190px;
}
</style>
<script language="javascript" type="text/javascript">
// 错误处理
window.onerror = function killerr() {
return true;
}
// 计算所需的两个因数
var param1, param2;
// 计算结果
var answer;
// 运算符
var oprt;
// 因数标记
var flag;
// 计算参数分配函数
function doCalc(val) {
if (document.getElementById("answer").getAttribute("value") == "ERROR" && val != "CE") {
// 计算器出错时提示,并终止操作
alert("Please reset calculator");
return false;
}
switch (val) {
// 操作符
case "+":
case "-":
相关文档:
1、function vv()
{
if(event.button==2)
{
alert('防止服务器负担过大,右键功能被屏蔽!')
......
在您的IE浏览器上运行含有JavaScript代码的页面时都会产生一个警告。这个“警告”确实很烦人,不知情的人看了还以为是病毒什么呢,很容易让人产生误解!
记得网上也有人称其为“IE的小黄条警告”。具体的什么叫法我们今天不用关心,我们关心的是如何去掉这个“警告”。具体方法如下:
点击 ......
/*样式*/
<style type="text/css">
td{font-size:12px;}
.item{text-decoration:none;width:100%;height:100%; line-height:22px;cursor:default;color:Black;vertical-align:middle}
.staticTab{cursor:default;height:22px}
  ......
下面都是个人理解以及查找的网上的资料,如有不对的地方请指正
prototype
prototype在这里是原型的意思,不是指那个框架...
每个函数就是一个对象(Function),当函数被解析后会添加一个prototype的对象,然后prototype会添加一个constructor的属性
它指向那个函数的
比如定义一个function test(){}
它会 ......