怎么在 Adobe Dreamweaver 写水仙花数代码啊?
求好心人帮忙
<html> <head> <title>计算水仙花数</title> <script type="text/javascript"> /*******************输出水仙花数的算法*******************************/ function Narcissus(s) { var i,j,k,n,m,l,reNum; reNum=""; if (s==3) /*输出100-999的水仙花数*/ { for(n=100;n<999;n++) { i = n / 100; j = n / 10 - i * 10; k = n % 10; if (n==Recursion(i,s) + Recursion(j,s) + Recursion(k,s)) reNum+=n+"<br/>"; } } else if (s == 4) /*输出1000-9999的水仙花数*/ { for (n = 1000; n <= 9999; n++) { i = n / 1000; j = n / 100 - i * 10; k = n / 10 - i * 100 - j * 10; l = n % 10; if (n == Recursion(i, s) + Recursion(j, s) + Recursion(k, s) + Recursion(l, s)) reNum+=n+"<br/>"; } } else if(s==5) /*输出10000-99999的水仙花数*/ { for (n = 10000; n <= 99999; n++) { i = n / 10000; j = n / 1000 - i * 10; k = n / 100 - i * 100 - j * 10; l = n / 10 - i * 1000 - j * 100 - k * 10; m = n % 10; if (n == Recursion(i, s) + Recursion(j, s) + Recursion(k, s) + Recursion(l, s) + Recursion(m, s)) reNum+=n+"<br/>"; } } else if (s ==34) /*输出100-9999的水仙花数*/ { for (n = 100; n <= 9999; n++) { i = n / 1000; j = n / 100 - i * 10; k = n / 10 - i * 100 - j * 10; l = n % 10; if (i != 0 && n==Recursion(i, 4) + Recursion(j, 4) + Recursion(k, 4) + Recursion(l, 4)) reNum+=n+"<br/>"; if (n== Recursion(j, 3) + Recursion(k, 3) + Recursion(l, 3)) reNum+=n+"<br/>"; } } else if(s == 45) /*输出1000-9999的水仙花水*/ { for (n = 1000; n <= 99999; n++) { i = n / 10000; j = n / 1000 - i * 10; k = n / 100 - i * 100 - j * 10; l = n / 10 - i * 1000 - j * 100 - k * 10; m = n % 10; if (i != 0 && n == Recursion(i, 5) + Recursion(j, 5) + Recursion(k, 5) + Recursion(l, 5) + Recursion(m, 5)) reNum+=n+"<br/>"; if (n == Recursion(j, 4) + Recursion(k, 4) + Recursion(l, 4) + Recursion(m, 4)) reNum+=n+"<br/>"; } } else /* 输出100-99999的水仙花数*/ { for (n = 100; n <= 99999; n++) { i = n / 10000; j = n / 1000 - i * 10; k = n / 100 - i * 100 - j * 10; l = n / 10 - i * 1000 - j * 100 - k * 10; m = n % 10; if (i != 0 && n == Recursion(i, 5) + Recursion(j, 5) + Recursion(k, 5) + Recursion(l, 5) + Recursion(m, 5)) reNum+=n+"<br/>"; else if (j != 0 && n == Recursion(j, 4) + Recursion(k, 4) + Recursion(l, 4) + Recursion(m, 4)) reNum+=n+"<br/>"; else if (n== Recursion(k, 3) + Recursion(l, 3) + Recursion(m, 3)) reNum+=n+"<br/>"; } } document.getElementById("Result").innerHTML=reNum; } /*********************用递归求数n的k次方*******************************/ function Recursion(n,k) { var m; if (k == 1) return n; else m=n*Recursion(n,k-1); return m; } </script> <script type="text/javascript"> function SelMedian_Change(Val) { Narcissus(parseInt(Val)); } </script> </head> <body> <select name="SelMedian" onchange="SelMedian_Change(this.options[this.selectedIndex].value);" > <option value="3">3----找出三位数所有的水仙花数!</option> <option value="4">4----找出四位数所有的水仙花数!</option> <option value="5">5----找出五位数所有的水仙花数!</option> <option value="34">34---你选择找出三、四位数的水仙花数!</option> <option value="45">45---你选择找出四、五位数的水仙花数!</option> <option value="35">35---你选择找出三、四、五位数的水仙花数!</option> </select>请选择位数<br/> 输出结果 <div id="Result"> </div> </body> </html>