在 body 里加个事件  onload="return onloadclick();"<asp:button id = bnt1 >
<script >
  if(如果是当前触发的id= bnt1)  //页面上有很多button
  {
       ...............
   }
</script >

解决方案 »

  1.   

    在 body 里加个事件 onload="return onloadclick();"<asp:button id = bnt1 >
    <script >
    function onloadclick()
    {
      if(如果是当前触发的id= bnt1) //页面上有很多button
      {
        ...............
      }
    }
    </script >
      

  2.   

    for (i = 0; i < document.getElementsByTagName("button").length; i++) {
                if (document.getElementsByName("refFormat")[i].id == "btn1") {
                    .....
                }
            }
      

  3.   

    就是我页面上有很多button
    当我点击 <asp:button id = bnt1 > 这个button 时来触发 body 里加的事件 onclick="return onloadclick();"
    <script >
    function onloadclick()
    {
    if(如果是当前触发的id = ‘bnt1’) //页面上有很多button
    {
    ...............
    }
    }
    </script >问题:如果是当前触发的id  怎么获得?
      

  4.   

    onclick="return onloadclick(this);"-----------------------------------
    function onloadclick(obj)
    {
    if(obj.id = ‘bnt1’) //页面上有很多button
    {
    ...............
    }
    }
      

  5.   


    <script >
    if(window.event.srcElement.id == "bnt1") //页面上有很多button
    {
    ...............
    }
    </script >
      

  6.   

    这里的event指的是 javascript中的事件