HKMUD 香港群俠傳

https://web.hkmud.com

使用者工具

網站工具


心得_柳綠山莊

差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

心得_柳綠山莊 [2020/11/04 18:10] – 建立 tsubame心得_柳綠山莊 [2020/11/04 18:10] (目前版本) – 移除 tsubame
行 1: 行 1:
-<html> 
-<script> 
-function change() { 
- var no1 = document.getElementById("no1").value; 
- var no2 = document.getElementById("no2").value; 
- var no3 = document.getElementById("no3").value; 
- var no4 = document.getElementById("no4").value; 
- var no5 = document.getElementById("no5").value; 
- var no6 = document.getElementById("no6").value; 
- var no7 = document.getElementById("no7").value; 
- var no8 = document.getElementById("no8").value; 
- var lno = Number(no1); 
- document.getElementById("txtArea").innerHTML="Answer is: <p>"; 
- findmod(no1, no2, no3, no4, no5, no6, no7, no8, lno); 
-} 
- 
-function parse() { 
- var txt = document.getElementById("txtInput").value; 
- var no1,no2,no3,no4,no5,no6,no7,no8; 
- 
- var ptn = /.*這個數,它除(.*)余(.*),它除(.*)余(.*),它除(.*)余(.*),它除(.*)余(.*)/; 
- 
- if (ptn.test(txt)) { 
- no1 = txt.replace(ptn,"$1"); 
- no2 = txt.replace(ptn,"$2"); 
- no3 = txt.replace(ptn,"$3"); 
- no4 = txt.replace(ptn,"$4"); 
- no5 = txt.replace(ptn,"$5"); 
- no6 = txt.replace(ptn,"$6"); 
- no7 = txt.replace(ptn,"$7"); 
- no8 = txt.replace(ptn,"$8"); 
- 
- document.getElementById("no1").value=no1; 
- document.getElementById("no2").value=no2; 
- document.getElementById("no3").value=no3; 
- document.getElementById("no4").value=no4; 
- document.getElementById("no5").value=no5; 
- document.getElementById("no6").value=no6; 
- document.getElementById("no7").value=no7; 
- document.getElementById("no8").value=no8; 
- 
- change(); 
-  
- } 
-} 
- 
-function findmod(n1, n2, n3, n4, n5, n6, n7, n8, lno) { 
- var n = Number(n1) + Number(n2); 
-  if (n % n7 == n8 && n % n5 == n6 && n % n3 == n4 && n % n1 == n2) { 
-  // if all correct then return n1 + remainder n2  
- console.log("Answer is: "+n); 
- document.getElementById("txtArea").innerHTML += n; 
-  } else if (Number(n) <= 10000) { 
-  //if cannot give corresponding remainder, then largest no (n1) x 2  
-  // and recursively run again 
-  return findmod(Number(n1) + Number(lno), n2, n3, n4, n5, n6, n7, n8, Number(lno)); 
-  } 
-} 
- 
-</script> 
-<body> 
-<input type="text" id="txtInput" size="60" value="這個數,它除4余0,它除24余0,它除90余48,它除101余95"> 
-<button onclick="parse()" value="Click">Click</button><BR><BR> 
-<input type="number" id="no1" size="5" value=4> / 
-<input type="number" id="no2" size="5" value=2><BR> 
-<input type="number" id="no3" size="3" value=37> / 
-<input type="number" id="no4" size="3" value=17><BR> 
-<input type="number" id="no5" size="3" value=90> / 
-<input type="number" id="no6" size="3" value=44><BR> 
-<input type="number" id="no7" size="3" value=112> / 
-<input type="number" id="no8" size="3" value=102><BR> 
-<p id="txtArea">  
-</p> 
-<button onclick="change()" value="Click">Click</button> 
- 
-</body> 
-</html> 
  

若無特別註明,本 wiki 上的內容都是採用以下授權方式: CC Attribution-Noncommercial-Share Alike 4.0 International
CC Attribution-Noncommercial-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki