<body onload="document.all['select1'].add(new Option('姓名','1'))">
<select id=select1>
</select>
</body>

解决方案 »

  1.   

    那假如此页面是openwindow 打开的,父页面中有<form name="globe">
    pwork 是个下拉框,我想在子页面中往父页面的pwork 下拉框中加"姓名" value="1"请问怎么加?
      

  2.   

    <body onload="opener.document.globe.pwork.add(new Option('姓名','1'))">
      

  3.   

    我收回刚才的话了,不时说错.(^-^)http://support.microsoft.com/default.aspx?scid=KB;en-us;q237831
      

  4.   

    我自己的解决方法是这样<body >
    <script>
    var str="<select name='pwork'><option value='1'>姓名</option></select>"
    window.opener.document.globe.pwork.outerHTML=str;
    </script>
    </body>
      

  5.   

    您的解决方案有问题,如果我开始select 有值,添加以后就全没了,就剩下,你刚刚添加的那条了。另外你给我的url,我正在看,我的需要就是那个样子的,不过我的出现问题,!openwindow打开的窗口的父应该是opener 吧?
      

  6.   

    //--------------------子窗口--------------------------------------//
    <html>
    <head>
    <script language=javascript>
    var rFrame;
    var rFrameDoc;
    var rForm;//------------  getFrame()
    //------------  Get references to objects in right frame
    function getFrame()
    {
       rFrame = self.opener;
       rFrameDoc = rFrame.document;
       rForm = rFrameDoc.globe;
    }//------------  failOpt()
    //------------  Reproduces failure
    function failOpt(elName,inText,inValue)
    {
    alert("ssss");
    //Get a reference to select box in the other frame
      var rSel = rForm(elName);//Create a new Option in this frame
      var myOpt = new Option(inText,inValue)//add option from this frame to select box in other frame
    alert("Check the select box to see if any item was added.");
    rSel.options[rSel.length] = myOpt;
    }</script></head>
    <body onload="getFrame()">
    添加单位成功!
    <input type=button name=trigger1 value="Reproduce Problem"
       onclick="failOpt( 'pwork','11111','11' );">
    </body>
    </html>
    //--------------------------------父窗口------------------------//
    <html>
    <head>
    <script>
    function songScript1(url)
    {
    var Win = window.open(url,"songScript1",'width=440,height=260,resizable=0,scrollbars=no,menubar=no,status=no' );
    }
    function newOpt(inText,inValue)
    {
    function newOpt(inText,inValue)
    {
    // Create element in this frame's tree
      var myOpt = new Option(inText,inValue)// return reference
      return myOpt
    }</script>
    </head>
    <body>
    <form name="globe"><select name="pwork"></select></form><a href="javascript:songScript1('addwork.php')">添加</a>
    </body>
    </html> 
    代码好像有错误?