一些个理解都在注释中表明
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Js2.aspx.cs" Inherits="Javascript_Js2" %>
<!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 runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
//算术运算符
document.write("算术运算符</br>")
var int1=12
var int2=10
var add=int1+int2
var sub=int1-int2
var mult=int1*int2
var div=int1/int2
var mod=int1%int2
document.write("数据1:"+int1+"</br>")
document.write("数据2:"+int2+"</br>")
document.write("数据相加"+add+"</br>")
document.write("数据相减"+sub+"</br>")
document.write("数据相乘"+mult+"</br>")
document.write("数据相除"+div+"</br>")
document.write("数据取余"+mod+"</br>")
//自增加
document.write("一元表达式,自增加</br>")
var hours=1
document.write("输出变量"+hours+"</br>")
hours++
document.write("递增后变量"+hours+"</br>")
//判断表达式
document.write("比较,判断表达式</br>")
var daysofmonth=28
month="February"
if(daysofmonth==29)
{
document.write("month : "+month+"</br>")
document.write("month : "+month)
}
else
document.write("days of month : "+daysofmonth+"</br>")
//逻辑表达式
document.write("逻辑表达式</br>")
var daysofmonth=28
month="February"
if(daysofmonth==29)
document.write("month : "+month+"</br>")
document.write("days of month : "+daysofmonth+"</br>")
//识别数字 isNan(123),返回false
document.write("识别数字</br>")
var int3=21
document.write(isNaN(int3)+"</br>")
//定时器
function timer11()
{
var t= window.setTimeout("alert('定时器')",5000)
alert(t)
}
//setTimeout(表达式,延时时间);//只执行一次,无周期
//setInterval(表达式,交互时间);//周期='交互时间'
//定期间隔
document.write("定期间隔,及清空时间")
var ss= window.setInterval("document.form1.txt2.value=document.form1.txt1.value",3000)//html中id 和name 同样可以抓到text
</script>
</head>
<body >
<form id="form1" runat="server">
<div>
<input type="button" value="定时器" οnclick="timer11()" />
<input type="text" id="txt1" name="txt3"/>
<input type="text" id="txt2" name="txt4" />
<input type="button" id="btn" value="清空时间" οnclick=clearInterval(ss) />
</div>
</form>
</body>
</html>