Header

  1. View current page

    석영이의 낙서장!

Profile_image?t=1225438807&type=small
훗!~ 밥은 먹고 다니냥?
0

AddEvent

addEvent.html 동적으로 event 추가 하는 처리 하기

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> addEvent Sample </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
<!--
 function addEvent(object, type, handler) {
  if (object.addEventListener) {
   object.addEventListener(type, handler, false);
  } else if (object.attachEvent) {
   object.attachEvent("on"+type,handler);
  } else {
   object["on"+type] = handler;
  }
 }

 window.onload = function () {
  var spin = document.createElement('img');
  spin.id = 'loadingImage';
  spin.src = "http://resource.tattersite.com/findingNemo/thumbnail/1/1047883812.w190-h210.resampled.jpg";
  addEvent(spin,'click',function() { self.close() });

  document.getElementById("bodyId").appendChild(spin);
 } 
//-->
</script>
</head>

<body id="bodyId">

</body>
</html>

Tags

History

Last edited on 10/06/2008 18:21 by 김석영

Comments (0)

You must log in to leave a comment. Please sign in.