23-2 ��Ʃw�q�ɪ��ϥ�

§Ú­Ì¥i¥H±N±`¥Îªº¨ç¦¡¡A©ñ¦b¤@­Ó¨ç¦¡©w¸qÀɤº¡AµM«á¦A±q¨ä¥Lµ{¦¡¤¤¡A¥[¤J¦¹ÀɮסA´N¥i¥H¨Ï¥Î¦¹¨ç¦¡©w¸qÀɤ¤©Ò©w¸qªº¨ç¦¡¡CWSH ©Ò¥Îªº¨ç¦¡ÀɮסA¥i¥H¨ã¦³¥ô¦ó°ÆÀɦW¡A¦ý§Ú­Ì³q±`±N¦¹Ãþ¨ç¦¡Àɮתº°ÆÀɦW³]©w¬° fun¡]³o¬O§Ú­Ó¤Hªº²ßºD¡A§A¤]¥i¥H¿ï¥Î¤£¦Pªº°ÆÀɦW¡^¡A¥H¸ê°Ï§O¡C

¨Ò¦p¡A§Ú­Ì¥i¥H±N­pºâ¥Ñ1¨ìnªºÁ`©Mªº¨ç¦¡¡A©ñ¦b sumFunction.fun¡A¦p¤U¡G

­ì©lÀÉ¡]sumFunction.fun¡^¡G¡]¦Ç¦â°Ï°ì«ö¨â¤U§Y¥i«þ¨©¡^
// ¦¹¨ç¼Æ­pºâ¥Ñ 1 ¥[¨ì n ªºÁ`©M
function sum(n) {
	var i, total=0;
	for (i=1; i<=n; i++)
		total = total + i;
	return(total);
}

­Y­n©I¥s¦¹Àɮשҩw¸qªº¨ç¦¡¡A³q±`§Ú­Ì¥²¶·±N¥Dµ{¦¡ªº°ÆÀɦW§ï¬° wsf¡A¨Ã¨Ï¥Î¤U­z¤è¦¡¨Ó¾É¤J¨ç¦¡©w¸qÀÉ¡G

<script src="sumFunction.fun"></script> ¨Ò¦p¡G

­ì©lÀÉ¡]sum03.wsf¡^¡G¡]¦Ç¦â°Ï°ì«ö¨â¤U§Y¥i«þ¨©¡^
<job>
<script src="sumFunction.fun"></script>
<script>
// ©I¥s¨ç¼Æ¥H­pºâ¥Ñ 1 ¥[¨ì n ªºÁ`©M
n = 40;
WScript.Echo("1+2+...+" + n + " = " + sum(n));
</script>
</job>

¬Æ¦Ü§Ú­Ì¥i¥H¥Ñ¤£¦Pªºµ{¦¡»y¨¥Àô¹Ò¡A¨Ó©I¥s JavaScript ªº¨ç¦¡¡A¦p¤U¡G

­ì©lÀÉ¡]sum04.wsf¡^¡G¡]¦Ç¦â°Ï°ì«ö¨â¤U§Y¥i«þ¨©¡^
<job>
<script src="sumFunction.fun"></script>

<script language=jscript>
// ¦b¤£¦Pªºµ{¦¡»y¨¥©I¥s¦P¤@­Ó¨ç¼Æ
n = 40;
WScript.Echo("1+2+...+" + n + " = " + sum(n) + " (via Jscript)");
</script>

<script language=vbscript>
n = 40
WScript.Echo("1+2+...+" & n & " = " & sum(n) & " (via Vbscript)")
</script>

</job>

¦b¤W­z½d¨Ò¤¤¡A§Ú­Ì¨Ï¥Î JScript ©M VBScript ¨Ó©I¥s¦P¤@­Ó¡]¥Ñ JScript ¨Ó¼¶¼gªº¡^¨ç¼Æ¡A°õ¦æ«á¥i±o¨ì¦P¼Ëªºµ²ªG¡AÅã¥Ü¦p¤U¡G

1+2+...+40 = 820 (via Jscript) 1+2+...+40 = 820 (via VBScript) ¨Æ¹ê¤W¡A§Ú­Ì¥i¥H¨Ï¥Î¦P¼Ë¤@­Ó¨ç¼Æ©w¸qÀÉ©ó«È¤áºÝªº JavaScript¡]¥Î©óºô­¶¡^¡B¦øªA¾¹ºÝªº JScript¡]¥Î©ó ASP¡^¡B¥»¾÷ªº JScript¡]¥Î©ó WSH¡^¡A¹F¨ì¡u¤@³½¤T¦Y¡vªº³Ì°ª¹Ò¬É¡A¥u¬O¦b¾É¤J¨ç¼Æ©w¸qÀɮɡA©Ò¥Îªº»yªk¤£ºÉ¬Û¦P¡C°²³]§Ú­Ì­n¾É¤J¨ç¼Æ©w¸qÀÉ file.fun¡A«h¦b¤W­z¤TºØÀô¹Ò¤U©Ò¥Îªº¾É¤J«ü¥O¦C¥X¦p¤U¡G
JScript µ{¦¡³]­p»PÀ³¥Î¡G¥Î©ó³æ¾÷ªº WSH Àô¹Ò