87,907
社区成员
发帖
与我相关
我的任务
分享
<div id="div1"> </div>
<script language=javascript>
var temp=new Array()
temp[temp.length]='<select name="list1" size="10" multiple class="option"> '
map={"Aa": "查询记录","Ab":"修改记录","Ac": "删除记录"}
for(var i in map){
temp[temp.length]="<option value='"
temp[temp.length]=i
temp[temp.length]="'>"
temp[temp.length]=map[i]
temp[temp.length]="</option>"
}
temp[temp.length]="</select>"
document.getElementById("div1").innerHTML=temp.join("")
</script>
package test1;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class Test15 {
public static void main(String[] args){
Map map=new HashMap();
map.put("Aa", "查询记录");
map.put("Ab", "修改记录");
map.put("Ac", "删除记录");
Iterator it=map.keySet().iterator();
StringBuffer sb=new StringBuffer();
sb.append("<select name=\"list1\" size=\"10\" multiple class=\"option\"> ");
while(it.hasNext()){
String temp=(String)it.next();
sb.append("<option value='").append(temp)
.append("'>").append((String)map.get(temp)).append("</option>");
}
sb.append("</select>");
System.out.println(sb.toString());
}
}