就是给下面的select从数据库中读取option的内容
<select name="example" id="example" size="1" onchange="redirect(this.options.selectedIndex)">
<option>语文</option>
<option>数学</option>
<option>英语</option>
</select>
<select name="stage2" id="stage2" size="1">
<option value="123">人民出版社</option>
<option value="456">网络系</option>
<option value="789">章节</option>
</select>
谁能把下面的js改成从数据库中读取的内容 现在是写死的
<script type="text/javascript">
<!--
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("Share JavaScript","")
group[0][1]=new Option("Dynamicdrive.com","")
group[0][2]=new Option("JavaScript","")
group[1][0]=new Option("分享JavaScript","")
group[1][1]=new Option("JavaScript2000","")
group[1][2]=new Option("无忧脚本","")
group[2][0]=new Option("Hotbot","")
group[2][1]=new Option("Infoseek","")
group[2][2]=new Option("Excite","")
group[2][3]=new Option("Lycos","")
var temp=document.doublecombo.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}
</script>
<select name="example" id="example" size="1" onchange="redirect(this.options.selectedIndex)">
<option>语文</option>
<option>数学</option>
<option>英语</option>
</select>
<select name="stage2" id="stage2" size="1">
<option value="123">人民出版社</option>
<option value="456">网络系</option>
<option value="789">章节</option>
</select>
谁能把下面的js改成从数据库中读取的内容 现在是写死的
<script type="text/javascript">
<!--
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("Share JavaScript","")
group[0][1]=new Option("Dynamicdrive.com","")
group[0][2]=new Option("JavaScript","")
group[1][0]=new Option("分享JavaScript","")
group[1][1]=new Option("JavaScript2000","")
group[1][2]=new Option("无忧脚本","")
group[2][0]=new Option("Hotbot","")
group[2][1]=new Option("Infoseek","")
group[2][2]=new Option("Excite","")
group[2][3]=new Option("Lycos","")
var temp=document.doublecombo.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货