Calling a particular function when multiple events are bound
<p>I have a site wide JS, which creates listeners for various events, but in certain conditions I need to call a particular function, like in code below, I need to call function <strong>call</strong>, but its not getting called. </p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script&gt;
window.onload = function ()
{    
   var inputs = document.getElementsByTagName("input");
   var len = inputs.length;

   for (var i=0; i &lt; len; i++) 
   {        
         if (inputs[i].getAttribute("type") == "text") 
         {    
                  var element = inputs[i];

                  element.onfocus = function() 
                  {    
                        var id = element.getAttribute("id");
                        alert(id);
                  }
          }
   }
}

function call(element)
{    
      element.value="";
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;input type="text" name="myvar1" value="same content" id="noviceid" onfocus="call(this);"&gt;
&lt;input type="text" name="myvar2" value="same content" id="noviceid" onfocus="call(this);"&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Please suggest. I would like to call both <strong>onfocus</strong>. I am new to javascript.</p>
