for(var i=0; i<document.applets.length; i++)
{
  var app = document.applets[i];
  alert(app.id);
}

解决方案 »

  1.   

    to meizz(梅花雪) 谢谢
    for(var i=0; i<document.applets.length; i++)
    {
      var app = document.applets[i];
      alert(app.id);  
      //我是可以弹出每个applet的ID但是我如何判断this和哪一个applet对象相等呢
      //你譬如通过this如果能找到applet对象 也就可以知道<Applet>的其他属性
    }
    -------------------
    为什么要通过this来找到applet这个对象呢?
    因为在页面上用鼠标单击其中一个Applet(没有事件响应),只能在Applet里面坐onclick事件,然后
    通知页面传当前的this对象.我希望通过this对象来找到单击的Applet区域,然后我用修饰框罩住模拟选中。
      

  2.   

    不好意思, 我看错题目了, 你的 this 是你开发 class 文件里的 this 吧. 而 trend1 是浏览器页面 window 下的一个对象, 我不知道在JAVA的class里是否可以直接访问到网页里的对象, 若是可以的话你可以直接把这个ID号作为一个 param 传递到你的 class 里处理了.
      

  3.   

    to  meizz(梅花雪) 
    没关系.谢谢
    间接方法有两种:
      一是如你所说的param传递
      二是在Applet都有属性isActive当单击过的applet设置为true
      通过window.document.applets.length循环遍历只要window.document.applets[i].isActive == true
      一定是this等于window.document.applets[i]这个对象
    我不知道是否可以通过this直接找到window.document.applets[i]