¿¹Á¦¿¡¼´Â ±â´ÉÇÔ¼ö°¡ µÎ¹ø È£ÃâµÈ´Ù.
<SCRIPT> var fcwidth=fclength=fcarea=0; // º¯¼ö ¼±¾ð°ú °ª ÇÒ´ç var fcheight=50; // º¯¼ö ¼±¾ð°ú °ª ÇÒ´ç indent='<span style=width:2em></span>'; // º¯¼ö ¼±¾ð°ú °ª ÇÒ´ç, µé¿©¾²±â(°£°Ý ³Ö±â) ½ºÅ¸ÀÏ document.write('(È£Ãâ Àü)<BR>'); // È£Ãâ Àü¿¡´Â ´çÃÊ ÁöÁ¤ÇÑ º¯¼ö°ª Àû¿ë document.write(indent+'fcwidth = '+fcwidth+'<BR>'); // º¯¼ö ³»¿ª Ãâ·Â document.write(indent+'fclength = '+fclength+'<BR>'); // º¯¼ö ³»¿ª Ãâ·Â document.write(indent+'fcarea = '+fcarea+'<BR>'); // º¯¼ö ³»¿ª Ãâ·Â testFunction(10,50); // ±â´ÉÇÔ¼ö È£Ãâ document.write('(È£Ãâ ÈÄ)<BR>'); // È£Ãâ ÈÄ¿¡µµ º¯¼ö°ªÀÌ ±â´ÉÇÔ¼ö ¼Ó¿¡¼¸¸ ÀÛ¿ëµÇ¹Ç·Î Àü´Þ ¾ÈµÊ document.write(indent+'fcwidth = '+fcwidth+'<BR>'); // º¯¼ö ³»¿ª Ãâ·Â document.write(indent+'fclength = '+fclength+'<BR>'); // º¯¼ö ³»¿ª Ãâ·Â document.write(indent+'fcarea = '+fcarea+'<BR>'); // º¯¼ö ³»¿ª Ãâ·Â document.write('<font color=blue>document.write(testFunction(20,30));</font> ·Î<font color=brown><BR>'); // º¯¼ö ³»¿ª Ãâ·Â document.write(testFunction(20,30)); // ±â´ÉÇÔ¼ö¸¦ È£ÃâÇÏ¸é¼ Ãâ·Â document.write('</font>'); // font ¸¶°¨ function testFunction(fcwidth, fclength){ // ±â´ÉÇÔ¼öÀÇ ½ÃÀÛ var fcarea=fcwidth*fclength; // ¸éÀû °è»ê, º¯¼ö ¼±¾ð°ú °ª ÇÒ´ç document.write('(È£Ãâ Áß)<BR>'); // ¸Þ½ÃÁö Ãâ·Â document.write(indent+'fcwidth = '+fcwidth+'<BR>'); // º¯¼ö ³»¿ª Ãâ·Â document.write(indent+'fclength = '+fclength+'<BR>'); // º¯¼ö ³»¿ª Ãâ·Â document.write(indent+'fcarea = '+fcarea+'<BR>'); // º¯¼ö ³»¿ª Ãâ·Â return fcarea; // return µÇ´Â °ª ÀÌ¿Ü¿¡´Â º¯¼ö°ªÀº ¸ðµÎ ÇöÀç ±â´ÉÇÔ¼ö¿¡¼¸¸ ÀÛ¿ëÇÑ´Ù. } // ±â´ÉÇÔ¼öÀÇ Á¾·á </SCRIPT>
<SCRIPT> br='<BR>'; // ÁÙ¹Ù²Þ º¯¼ö function getArea(radius){ with(Math){ // with ¸¦ »ç¿ëÇÑ °è»ê area=PI*(radius*radius); cosine=cos(radius); sine=sin(radius); } str='area='+area+br+'cosine('+radius+')='+cosine+br+'sine('+radius+')='+sine; // °è»ê °á°ú Ãâ·Â ¹®ÀÚ¿¿¡ Ãß°¡ showarea.innerHTML=str; // °è»ê °á°ú Ãâ·Â } </SCRIPT> <FORM name=form1> Á÷°æ: <INPUT name=input1 value='100' size=6 style="text-aligh:right"> <INPUT type=button value="È®ÀÎ" onClick="getArea(this.form.input1.value)"> </FORM> <DIV id="showarea" class=show style=width:300;text-align:center;height:5em alt="°á°ú">°á°ú Ç¥½Ã À§Ä¡</DIV>