title: adding event listener cross browser
body: <p>my problem here:why doesn't this code work ????? ... the message doesn't appear</p>
  
  <p>i'm trying to add event listener to element x on event click  </p>
  
  <pre><code>    function test()
      {
      alert("test");
      }
  
  var EventsCrossBrowsers = 
   {
      addEvents:(function(element,event,func)
                {
                      if(element.addEventListener)
                      {
                          return elemenet.addEventListener(event,func,false);
                      }
                      else if(elemenet.attachEvent)
                      {
                          return elemenet.attachEvent("on"+event,func);
                      }
                }());
   }
  
   var x =document.getElementById("test");
  
  EventsCrossBrowsers.addEvents(x,"click",test);
  </code></pre>
  
  <p>thanks alot jfriend00....
  the most smiple way i think :-</p>
  
  <pre><code>function test()
  {
      alert("test");
  }
  
  function addEventsCrossBrowsers(elemenet,event,func)
  {
      if(elemenet.addEventListener)
      {
          elemenet.addEventListener(event,func,false);
      }
      else if(elemenet.attachEvent)
      {
          elemenet.attachEvent("on"+event,func);
      }
  }
  var x =document.getElementById("test");
  addEventsCrossBrowsers(x,"click",test);
  </code></pre>
  
  <p>your second way is almost the same except i don't understand the return ...
  thank you again...</p>