1 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="JavaScript_Demo.aspx.cs" Inherits="JavaScript_Demo" %>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5 <html xmlns="http://www.w3.org/1999/xhtml">
6 <head runat="server">
7 <title></title>
8 <script type="text/javascript">
9 void function my_alert()
10 {
11 window.alert("提示,确认,警告");
12 }
13 void function my_confirm()
14 {
15 window.confirm("单击确定继续,单击取消停止");
16 }
17 function my_confirm2()
18 {
19 var bResult=window.confirm("你确认吗?");
20 if(bResult==true)
21 {
22 return true;
23 }
24 else
25 {
26 return false;
27 }
28 }
29 function my_prompt() {
30 window.prompt("欢迎?", "请输入你的姓名:");
31 }
32 function Button1_onclick()
33 {
34 // my_alert();
35 if (my_confirm2() == true) {
36 window.alert("返回真");
37 }
38 else {
39 var name = my_prompt();
40 if (name != "") {
41 window.alert(name);
42 }
43 }
44
45 }
46
47 function get_onclick() {
48
49 var d, s = "今天是:";
50 d = new Date();
51 s += d.getDate() + "/";
52 s += d.getMonth() + "/";
53 s += d.getYear();
54 TextInfo.value = s;
55
56 }
57
58 function TextInfo_onclick() {
59
60 }
61
62 </script>
63 <style type="text/css">
64 #Text1
65 {
66 width: 157px;
67 }
68 </style>
69 </head>
70 <body>
71 <form id="form1" runat="server">
72 <div>
73
74 </div>
75 </form>
76 <p>
77 <input id="Button1" type="button" value="提示框" onclick="return Button1_onclick()" /></p>
78 <p>
79 <input id="TextInfo" type="text" onclick="return TextInfo_onclick()" />
80 </p>
81 <input id="get" type="button" value="得到日期" onclick="return get_onclick()" />
82 </body>
83 </html>
敏于事,慎于言