<html>
<HEAD>
<title>例子</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><SCRIPT LANGUAGE="JavaScript">
var meng1Array =  new Array("('选择Heha.net栏目内容','',true,true)",
"('学习 XML')",
"('学习 Javascript')",
"('学习 PHP')");
var mengArray =  new Array("('选择Myrice.com栏目内容','',true,true)",
"('学习 Flash')",
"('学习 Dreamweaver Ultradev')",
"('学习 Java')");
var meng2Array =  new Array("('选择China.com栏目内容','',true,true)",
"('查找歌词')",
"('其他')");function populatemxhweb(inForm,selected) {
var selectedArray = eval(selected + "Array");
while (selectedArray.length < inForm.mxhweb.options.length) {
inForm.mxhweb.options[(inForm.mxhweb.options.length - 1)] = null;
}
for (var i=0; i < selectedArray.length; i++) {
eval("inForm.mxhweb.options[i]=" + "new Option" + selectedArray[i]);
}if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0);
}}
//以下不影响}</script>
<link rel="stylesheet" href="../css/css.css" type="text/css">
</head><body topmargin="0" leftmargin="0" marginweight="0" marginheight="0"  bgcolor="#0099FF" oncontextmenu="return false;"><p>&nbsp;</p>
<font color="#000066">说明:适用于IE4,IE5.5,IE5,NS4+,NS6。早期版本的IE5.0可能无法工作。</font> 
<center>
<form name="globe">
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<select  onChange="populatemxhweb(document.globe,this.options[selectedIndex].value)">
<option>请选择
<option value="meng">http://lucky.myrice.com
<option value="meng1">http://go.163.com/colorweb
<option value="meng2">http://egirl.51.net
</select>
</td>
<td>
<select name="mxhweb" onChange="window.open('http://egirl.51.net')">
<option value=''>☆ 请选择上面的选项 ☆</option>
</select>
</td>
</tr>
</table>
<br>
<br>
<br>
<br>
<br>
<input type="button" value="关闭本页" onclick="window.close()">
</form>
</center>
</body>
</html>

解决方案 »

  1.   

    Soory!错了!<html>
    <head>
    <script language="JavaScript">
     
    <!--
    function addSrcToDestList() {
    destList = window.document.forms[0].destList;
    srcList = window.document.forms[0].srcList; 
    var len = destList.length;
    for(var i = 0; i < srcList.length; i++) {
    if ((srcList.options[i] != null) && (srcList.options[i].selected)) {var found = false;
    for(var count = 0; count < len; count++) {
    if (destList.options[count] != null) {
    if (srcList.options[i].text == destList.options[count].text) {
    found = true;
    break;
          }
       }
    }
    if (found != true) {
    destList.options[len] = new Option(srcList.options[i].text); 
    len++;
             }
          }
       }
    }function deleteFromDestList() {
    var destList  = window.document.forms[0].destList;
    var len = destList.options.length;
    for(var i = (len-1); i >= 0; i--) {
    if ((destList.options[i] != null) && (destList.options[i].selected == true)) {
    destList.options[i] = null;
          }
       }
    }
    // -->
    </SCRIPT>
    </head>
    <body>
    <center>
    <form method="POST">
    <table bgcolor="#FFFFCC"><tr>
    <td bgcolor="#FFFFCC" width="85">
    <select size="6" name="srcList" multiple>
    <option value="1">Item 1
    <option value="2">Item 2
    <option value="3">Item 3
    <option value="4">Item 4
    <option value="5">Item 5
    <option value="6">Item 6
    </select>
    </td>
    <td bgcolor="#FFFFCC" width="74" align="center">
    <input type="button" value=" 增加到右边 " onClick="javascript:addSrcToDestList()">
    <br><br>
    <input type="button" value=" 从右边删除 " onclick="javascript:deleteFromDestList();">
    </td>
    <td bgcolor="#FFFFCC" width="69">
    <select size="6" name="destList" multiple>
    </select>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
      

  2.   

    function additems(){
    var f=document.all.select1
    var t=document.all.select2
    for(i=f.length-1;i>=0;i--)
    if(f.options[i].selected){
    var n=t.length++
    t.options[n].text=f.options[i].text;
    t.options[n].value=f.options[i].value;
    f.remove(i);//删除原来的,是否删除根据你的需要
    }
      }