VBScript attachEvent ¸Þ¼­µå¸¦ »ç¿ëÇÑ ¹è°æ»ö º¯°æ ¿¹Á¦

Ŭ¸¯ÇÏ¸é ¹è°æ»öÀÌ º¯°æÇÏ´Â SPAN

ÅؽºÆ®¸¦ Ŭ¸¯ÇÏ¸é ¹è°æ»öÀÌ º¯ÇÏ´Â VBScript¿¡¼­ attachEvent ¸Þ¼­µå¸¦ »ç¿ëÇÑ ¿¹Á¦.

<SCRIPT language="VBS">
function setupEventHandler()
  set fpchgBackground=getRef("chgBackground")
  call mySpan.attachEvent("onclick", fpchgBackground)
  set backBackground=getRef("returnBackground")
  call myBut.attachEvent("onclick", backBackground)
end function
function chgBackground()
  document.bgColor="yellow"
end function
function returnBackground()
  document.bgColor=""
end function
</SCRIPT>
<STYLE>
.code {font-size:9pt;color:026;font-family:±¼¸²;background:#dff;border:solid 1 #aea;}
.method { background:#ffeeee;color:#a42;padding-left:3px;padding-right:3px;font-weight:bold;}
</STYLE>
</HEAD>

<BODY onload="setupEventHandler()" language="VBS" style="padding:1em;">
<DIV style="border:solid 1 gray;margin:1em;padding:1em;background:efe">
<DIV title="°á°ú" style="border:solid 1 blue;padding:1em">
<SPAN id="mySpan"
  style="cursor:hand;border:solid 1 blue;padding:5;background:eff">Ŭ¸¯ÇÏ¸é ¹è°æ»öÀÌ º¯°æÇÏ´Â SPAN</SPAN><BR>
<BUTTON id="myBut" style=margin:2px;margin-top:9px>Ŭ¸¯ÇÏ¸é ¿ø»ó º¹±Í</BUTTON>
</DIV>
</BODY>
</HTML>