谁能告诉我下面的javascript代码有什么问题,谢谢.(20分)

Y

ydjjld

Unregistered / Unconfirmed
GUEST, unregistred user!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>请选择</title>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>下拉列表示例</title>
</head>

<SCRIPT language=JavaScript>
function setFirst(S){
S.First.length=4;
S.First.options[0].value="a";
S.First.options[0].text="a";

S.First.options[1].value="b";
S.First.options[1].text="b";

S.First.options[2].value="c";
S.First.options[2].text="c";

S.First.options[3].value="无";
S.First.options[3].text="**请选择省份**";
S.First.options[3].selected=true;
}
function setsecond(D){
var valueFirst=D.First.options[D.First.selectedIndex].value;
if(valueFirst.indexOf("无")==0)
{
D.second.length=1;D.second.options[0].value="无";
D.second.options[0].text="**请选择城市**"
D.second.options[0].selected=true;
}
else
if(valueFirst.indexOf("a")==0)
{
D.second.length=3;

D.second.options[0].value=abuse;
D.second.options[0].text=abuse;

D.second.options[1].value=abandon;
D.second.options[1].text=abandon;

D.second.options[2].value=acuse;
D.second.options[2].text=acuse;

}
else
if(valueFirst.indexOf("b")==0)
{
D.second.length=3;

D.second.options[0].value=bee;
D.second.options[0].text=bee;

D.second.options[1].value=bad;
D.second.options[1].text=bad;

D.second.options[2].value=born;
D.second.options[2].text=born;

}
else
if(valueFirst.indexOf("c")==0)
{
D.second.length=3;

D.second.options[0].value=city;
D.second.options[0].text=city;

D.second.options[1].value=capity;
D.second.options[1].text=capity;

D.second.options[2].value=car;
D.second.options[2].text=car;

}
}
</script>

<body onload=setFirst(document.select);setsecond(document.select)>
<Form name="select" method="POST" action="xxx.asp">
<center>
<Table>
<TR> <td>请选择:</td>
<TD ><SELECT onchange=setsecond(document.select) name=First size="1" ></SELECT> <SELECT name=second size="1" ></SELECT> </TD>
</TR>
</Table></center>
</Form>

</body>
</html>
 
bee 没打引号:
D.second.options[0].value=bee;
D.second.options[0].text=bee;
应为:
D.second.options[0].value='bee';
D.second.options[0].text='bee';
其它几个也一样。
 
谢谢楼上的朋友.
不过可能因为楼上的与我delphi 都用多了,经常把单引号与双引号弄混了:)
再次感谢!
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
716
import
I
S
回复
0
查看
823
SUNSTONE的Delphi笔记
S
顶部