annotate Looping.xhtml @ 10:308cc64c24b9 >>178

Goのソースコードを追加。
author "uncorrelated zombie" <uncorrelated@yahoo.co.jp>
date Thu, 24 Feb 2011 07:31:17 +0900
parents 30b521e712f5
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
1 <?xml version="1.0" encoding="UTF-8"?>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
5 <head>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
6 <title>Looping</title>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
7 <script type="text/javascript"><![CDATA[
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
8
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
9 var Looping = function(){
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
10 this.n0 = 0;
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
11 this.calc = function(n){
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
12 var n1 = this.n0 + (1 - 2*(n%2));
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
13 this.n0 = n;
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
14 return n1;
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
15 };
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
16 };
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
17
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
18 function benchmark(){
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
19
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
20 document.forms[0].elements["text1"].value = "";
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
21 document.forms[0].elements["text2"].value = "";
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
22 var o = new Looping();
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
23 var n = 1;
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
24 var st = new Date();
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
25 for(var c=0;c<2147483647;c++){
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
26 n = o.calc(n);
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
27 }
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
28 var et = new Date();
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
29 document.forms[0].elements["text1"].value = n;
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
30 document.forms[0].elements["text2"].value = (et - st)/1000;
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
31 }
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
32
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
33 ]]></script>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
34 <style type="text/css">
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
35 input { width: 100%; }
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
36 </style>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
37 </head>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
38 <body>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
39 <form>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
40 <div style="width:320px;">
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
41 <div style="margin:4px;">
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
42 計算結果
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
43 <input type="text" name="text1" value="" />
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
44 </div>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
45 <div style="margin:4px;">
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
46 経過時間
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
47 <input type="text" name="text2" value="" />
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
48 </div>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
49 <div style="margin:4px;">
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
50 <input type="button" value="実行" onclick="benchmark();" />
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
51 </div>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
52 </div>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
53 </form>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
54 </body>
30b521e712f5 JavaScript (xhtml) のソースコードを追加。
"uncorrelated zombie" <uncorrelated@yahoo.co.jp>
parents:
diff changeset
55 </html>