if(document.formid.selectid)
alert("selectid在formid中");
else
alert("selectid不在formid中");
比较笨的一种想法,试试

解决方案 »

  1.   

    to epbon(没有) ( ) 不行啊,我不知道这个SELECT控件的上一级是谁啊,但我想查出来,无法设定formid啊
      

  2.   

    if(document.getElement("selectid").form)
    {
    alert("属于form");
    }
    else
    {
    alert("属于document");
    }
      

  3.   

    epbon的方法就可以了if(formid.selectid)
        //在form中
    else
       //不在form中
      

  4.   

    1。同意梅雪香@深圳,我多了一个document。此法适用已知formid的情况
    2。刚才没有领会楼主的意思,jouwei(九维) 的方法基本正确,但需要调整一下,应该就可以满足搂住的需求了,此法适用未知formid的情况
    if(document.getElementByID("selectid").form) 
    //ie里好像不支持getElementByID,可以用document.all("selectid")代替;
    {
    alert("属于form");
    alert(document.getElementByID("selectid").form.length)   //值为1
    }
    else
    {
    alert("属于document");
    }