<HEAD>
<SCRIPT language=javascript >
var bigkinds=new Array(0);
var bigvalue=new Array(0);
var kinds=new Array(0);
var values=new Array(0);
var big=0;
var small=0;
function init() {
initarrays();
initselects();
}
function findindex(seltemp,newvalue) {
for (var i=0;i<seltemp.length;i++)
if (seltemp.options[i].value==newvalue) break;
return i;
}
function changebig(newvalue) {
document.f1.s2.selectedIndex=findindex(document.f1.s2,newvalue);
big=newvalue;
changeparam("BigkindProduct",newvalue);
updates3(document.f1.s2.selectedIndex);
changesmall(document.f1.s3.options[0].value);
}
function changesmall(newvalue) {
document.f1.s3.selectedIndex=findindex(document.f1.s3,newvalue);
small=newvalue;
}
function initselects() {
document.f1.s2.options.length=0;
for (var i=0;i<bigkinds.length;i++) {
document.f1.s2.options.length++;
document.f1.s2.options[i].text=bigkinds[i];
document.f1.s2.options[i].value=bigvalue[i];
}
document.f1.s1.selectedIndex=0;
document.f1.s2.selectedIndex=1;
updates3(document.f1.s2.options[1].value-1);
}
function updates3(n) {
document.f1.s3.options.length=0;
for (var i=0;i<kinds[n].length;i++) {
document.f1.s3.options.length++;
document.f1.s3.options[i].text=kinds[n][i];
document.f1.s3.options[i].value=values[n][i];
}
document.f1.s3.selectedIndex=0;
}
function initarrays()
{
addbig("C语言概述",1);
addsamll(1,"C语言历史背景",1);
addsamll(1,"C语言特点",2);
addsamll(1,"简单的C程序介绍",3);
addsamll(1,"C程序的上机步骤",4);
addbig("数据类型、运算符与表达式",2);
addsamll(2,"C的数据类型",1);
addsamll(2,"常量与变量",2);
addsamll(2,"整型数据",3);
addsamll(2,"实型数据",4);
addsamll(2,"字符型数据",5);
addsamll(2,"变量赋初值",6);
addsamll(2,"各种数据类型间的混合运算",7);
addsamll(2,"算术运算符与算术表达式",8);
addsamll(2,"赋值运算符与赋值表达式",9);
addsamll(2,"逗号运算符与逗号表达式",10);
addbig("最简单的C程序设计",3);
addsamll(3,"C语句概述",1);
addsamll(3,"程序的三种基本结构",2);
addsamll(3,"赋值语句",3);
addsamll(3,"数据输出",4);
addsamll(3,"数据输入",5);
addsamll(3,"程序举例",6);
}
function addbig(disptext,newvalue) {
bigkinds.length++;
bigkinds[bigkinds.length-1]=disptext;
bigvalue.length++;
bigvalue[bigvalue.length-1]=newvalue;
kinds.length++;
kinds[kinds.length-1]=new Array(0);
values.length++;
values[values.length-1]=new Array(0);
}
function addsmall(n,disptext,newvalue) {
kinds[n-1].length++;
kinds[n-1][kinds[n-1].length-1]=disptext;
values[n-1].length++;
values[n-1][values[n-1].length-1]=newvalue;
}
</SCRIPT>
<TITLE>1111111</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="bjsoso.files/text.css" rel=stylesheet>
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">
<DIV align=center>
<TABLE id=AutoNumber1
style="BORDER-LEFT-WIDTH: 1px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 1px"
borderColor=#111111 cellSpacing=0 borderColorDark=#000000 cellPadding=0
width=375 bgColor=#c0c0c0 borderColorLight=#000000 border=0>
<TBODY>
<TR>
<TD style="BORDER-RIGHT: medium none; BORDER-LEFT: medium none" vAlign=top
width="100%" bgColor=#e7e7e7>
<FORM class=sfont name=f1
action=http://localhost/search.php
method=post><SPAN class=pt9>查询范围:</SPAN>
<SELECT class=pt9 onchange=changebig(this.options[this.selectedIndex].value) name=s2>
<OPTION value=1 selected>C语言概述</OPTION>
<OPTION value=2>数据类型、运算符与表达式</OPTION>
<OPTION value=3>最简单的C程序设计</OPTION>
</SELECT>
<SELECT class=pt9 onchange=changesmall(this.options[this.selectedIndex].value) name=s3>
<OPTION value=1 selected>C语言历史背景</OPTION><OPTION value=2>C语言特点</OPTION><OPTION value=3>简单的C程序介绍</OPTION><OPTION value=4>C程序的上机步骤</OPTION></SELECT><BR><BR>关键字: <INPUT
class=pt9 size=10 name=kw1> <INPUT type=radio CHECKED value=and name=rdb>
与 <INPUT type=radio value=or name=rdb> 或 <INPUT class=pt9 size=10
name=kw2> <INPUT class=pt9 type=submit value=" 搜 索 " name=submit></SPAN></FORM></TD></TR>
<TBODY></TBODY></TABLE>
<SCRIPT language=javascript>
init();
changebig(1);
changesmall(1);
</SCRIPT>
</DIV></BODY></HTML>
7 个解决方案
#1
问题是什么呀?
#2
没有changeparam函数呀,呵呵,你的问题是什么?
#3
除了chenzengxi(懒猫)说的,还有2个问题
1。 function initselects()中
document.f1.s1.selectedIndex=0; ->document.f1.s2.selectedIndex=0;
2。 function initarrays()中
所有addsamll-> addsmall
呵呵,笔误
1。 function initselects()中
document.f1.s1.selectedIndex=0; ->document.f1.s2.selectedIndex=0;
2。 function initarrays()中
所有addsamll-> addsmall
呵呵,笔误
#4
<HTML>
<HEAD>
<SCRIPT language=javascript >
var bigkinds=new Array(0);
var bigvalue=new Array(0);
var kinds=new Array(0);
var values=new Array(0);
var big=0;
var small=0;
function init() {
initarrays();
initselects();
}
function findindex(seltemp,newvalue) {
for (var i=0;i<seltemp.length;i++)
if (seltemp.options[i].value==newvalue) break;
return i;
}
function changebig(newvalue) {
document.f1.s2.selectedIndex=findindex(document.f1.s2,newvalue);
big=newvalue;
// changeparam("BigkindProduct",newvalue); //不知道干啥
updates3(document.f1.s2.selectedIndex);
changesmall(document.f1.s3.options[0].value);
}
function changesmall(newvalue) {
document.f1.s3.selectedIndex=findindex(document.f1.s3,newvalue);
small=newvalue;
}
function initselects() {
document.f1.s2.options.length=0;
for (var i=0;i<bigkinds.length;i++) {
document.f1.s2.options.length++;
document.f1.s2.options[i].text=bigkinds[i];
document.f1.s2.options[i].value=bigvalue[i];
}
document.f1.s1.selectedIndex=0;
document.f1.s2.selectedIndex=1;
updates3(document.f1.s2.options[1].value-1);
}
function updates3(n) {
document.f1.s3.options.length=0;
for (var i=0;i<kinds[n].length;i++) {
document.f1.s3.options.length++;
document.f1.s3.options[i].text=kinds[n][i];
document.f1.s3.options[i].value=values[n][i];
}
document.f1.s3.selectedIndex=0;
}
function initarrays()
{
addbig("C语言概述",1);
addsamll(1,"C语言历史背景",1);
addsamll(1,"C语言特点",2);
addsamll(1,"简单的C程序介绍",3);
addsamll(1,"C程序的上机步骤",4);
addbig("数据类型、运算符与表达式",2);
addsamll(2,"C的数据类型",1);
addsamll(2,"常量与变量",2);
addsamll(2,"整型数据",3);
addsamll(2,"实型数据",4);
addsamll(2,"字符型数据",5);
addsamll(2,"变量赋初值",6);
addsamll(2,"各种数据类型间的混合运算",7);
addsamll(2,"算术运算符与算术表达式",8);
addsamll(2,"赋值运算符与赋值表达式",9);
addsamll(2,"逗号运算符与逗号表达式",10);
addbig("最简单的C程序设计",3);
addsamll(3,"C语句概述",1);
addsamll(3,"程序的三种基本结构",2);
addsamll(3,"赋值语句",3);
addsamll(3,"数据输出",4);
addsamll(3,"数据输入",5);
addsamll(3,"程序举例",6);
}
function addbig(disptext,newvalue) {
bigkinds.length++;
bigkinds[bigkinds.length-1]=disptext;
bigvalue.length++;
bigvalue[bigvalue.length-1]=newvalue;
kinds.length++;
kinds[kinds.length-1]=new Array(0);
values.length++;
values[values.length-1]=new Array(0);
}
function addsamll(n,disptext,newvalue) {
kinds[n-1].length++;
kinds[n-1][kinds[n-1].length-1]=disptext;
values[n-1].length++;
values[n-1][values[n-1].length-1]=newvalue;
}
</SCRIPT>
<TITLE>1111111</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="bjsoso.files/text.css" rel=stylesheet>
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">
<DIV align=center>
<TABLE id=AutoNumber1
style="BORDER-LEFT-WIDTH: 1px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 1px"
borderColor=#111111 cellSpacing=0 borderColorDark=#000000 cellPadding=0
width=375 bgColor=#c0c0c0 borderColorLight=#000000 border=0>
<TBODY>
<TR>
<TD style="BORDER-RIGHT: medium none; BORDER-LEFT: medium none" vAlign=top
width="100%" bgColor=#e7e7e7>
<FORM class=sfont name=f1
action=http://localhost/search.php
method=post><SPAN class=pt9>查询范围:</SPAN>
<SELECT class=pt9 onchange=changebig(this.options[this.selectedIndex].value) name=s2>
<OPTION value=1 selected>C语言概述</OPTION>
<OPTION value=2>数据类型、运算符与表达式</OPTION>
<OPTION value=3>最简单的C程序设计</OPTION>
</SELECT>
<SELECT class=pt9 onchange=changesmall(this.options[this.selectedIndex].value) name=s3>
<OPTION value=1 selected>C语言历史背景</OPTION><OPTION value=2>C语言特点</OPTION><OPTION value=3>简单的C程序介绍</OPTION><OPTION value=4>C程序的上机步骤</OPTION></SELECT><BR><BR>关键字: <INPUT
class=pt9 size=10 name=kw1> <INPUT type=radio CHECKED value=and name=rdb>
与 <INPUT type=radio value=or name=rdb> 或 <INPUT class=pt9 size=10
name=kw2> <INPUT class=pt9 type=submit value=" 搜 索 " name=submit></SPAN></FORM></TD></TR>
<TBODY></TBODY></TABLE>
<SCRIPT language=javascript>
init();
changebig(1);
changesmall(1);
</SCRIPT>
</DIV></BODY></HTML>
<HEAD>
<SCRIPT language=javascript >
var bigkinds=new Array(0);
var bigvalue=new Array(0);
var kinds=new Array(0);
var values=new Array(0);
var big=0;
var small=0;
function init() {
initarrays();
initselects();
}
function findindex(seltemp,newvalue) {
for (var i=0;i<seltemp.length;i++)
if (seltemp.options[i].value==newvalue) break;
return i;
}
function changebig(newvalue) {
document.f1.s2.selectedIndex=findindex(document.f1.s2,newvalue);
big=newvalue;
// changeparam("BigkindProduct",newvalue); //不知道干啥
updates3(document.f1.s2.selectedIndex);
changesmall(document.f1.s3.options[0].value);
}
function changesmall(newvalue) {
document.f1.s3.selectedIndex=findindex(document.f1.s3,newvalue);
small=newvalue;
}
function initselects() {
document.f1.s2.options.length=0;
for (var i=0;i<bigkinds.length;i++) {
document.f1.s2.options.length++;
document.f1.s2.options[i].text=bigkinds[i];
document.f1.s2.options[i].value=bigvalue[i];
}
document.f1.s1.selectedIndex=0;
document.f1.s2.selectedIndex=1;
updates3(document.f1.s2.options[1].value-1);
}
function updates3(n) {
document.f1.s3.options.length=0;
for (var i=0;i<kinds[n].length;i++) {
document.f1.s3.options.length++;
document.f1.s3.options[i].text=kinds[n][i];
document.f1.s3.options[i].value=values[n][i];
}
document.f1.s3.selectedIndex=0;
}
function initarrays()
{
addbig("C语言概述",1);
addsamll(1,"C语言历史背景",1);
addsamll(1,"C语言特点",2);
addsamll(1,"简单的C程序介绍",3);
addsamll(1,"C程序的上机步骤",4);
addbig("数据类型、运算符与表达式",2);
addsamll(2,"C的数据类型",1);
addsamll(2,"常量与变量",2);
addsamll(2,"整型数据",3);
addsamll(2,"实型数据",4);
addsamll(2,"字符型数据",5);
addsamll(2,"变量赋初值",6);
addsamll(2,"各种数据类型间的混合运算",7);
addsamll(2,"算术运算符与算术表达式",8);
addsamll(2,"赋值运算符与赋值表达式",9);
addsamll(2,"逗号运算符与逗号表达式",10);
addbig("最简单的C程序设计",3);
addsamll(3,"C语句概述",1);
addsamll(3,"程序的三种基本结构",2);
addsamll(3,"赋值语句",3);
addsamll(3,"数据输出",4);
addsamll(3,"数据输入",5);
addsamll(3,"程序举例",6);
}
function addbig(disptext,newvalue) {
bigkinds.length++;
bigkinds[bigkinds.length-1]=disptext;
bigvalue.length++;
bigvalue[bigvalue.length-1]=newvalue;
kinds.length++;
kinds[kinds.length-1]=new Array(0);
values.length++;
values[values.length-1]=new Array(0);
}
function addsamll(n,disptext,newvalue) {
kinds[n-1].length++;
kinds[n-1][kinds[n-1].length-1]=disptext;
values[n-1].length++;
values[n-1][values[n-1].length-1]=newvalue;
}
</SCRIPT>
<TITLE>1111111</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="bjsoso.files/text.css" rel=stylesheet>
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">
<DIV align=center>
<TABLE id=AutoNumber1
style="BORDER-LEFT-WIDTH: 1px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 1px"
borderColor=#111111 cellSpacing=0 borderColorDark=#000000 cellPadding=0
width=375 bgColor=#c0c0c0 borderColorLight=#000000 border=0>
<TBODY>
<TR>
<TD style="BORDER-RIGHT: medium none; BORDER-LEFT: medium none" vAlign=top
width="100%" bgColor=#e7e7e7>
<FORM class=sfont name=f1
action=http://localhost/search.php
method=post><SPAN class=pt9>查询范围:</SPAN>
<SELECT class=pt9 onchange=changebig(this.options[this.selectedIndex].value) name=s2>
<OPTION value=1 selected>C语言概述</OPTION>
<OPTION value=2>数据类型、运算符与表达式</OPTION>
<OPTION value=3>最简单的C程序设计</OPTION>
</SELECT>
<SELECT class=pt9 onchange=changesmall(this.options[this.selectedIndex].value) name=s3>
<OPTION value=1 selected>C语言历史背景</OPTION><OPTION value=2>C语言特点</OPTION><OPTION value=3>简单的C程序介绍</OPTION><OPTION value=4>C程序的上机步骤</OPTION></SELECT><BR><BR>关键字: <INPUT
class=pt9 size=10 name=kw1> <INPUT type=radio CHECKED value=and name=rdb>
与 <INPUT type=radio value=or name=rdb> 或 <INPUT class=pt9 size=10
name=kw2> <INPUT class=pt9 type=submit value=" 搜 索 " name=submit></SPAN></FORM></TD></TR>
<TBODY></TBODY></TABLE>
<SCRIPT language=javascript>
init();
changebig(1);
changesmall(1);
</SCRIPT>
</DIV></BODY></HTML>
#5
真是错误一大堆!!!
#6
这个程序也写的太繁琐了一点,其实不用这么麻烦的。
s2和s3里的OPTION其实都不用写进去,initselects()初始塞进去就行了.
还有数组可以用["name1",["name1","name2","name3"]]的方式,就根本不用那么多代码,转来转去不头晕才怪。
s2和s3里的OPTION其实都不用写进去,initselects()初始塞进去就行了.
还有数组可以用["name1",["name1","name2","name3"]]的方式,就根本不用那么多代码,转来转去不头晕才怪。
#7
hehe,sorry,我找了一下午没找到,3x,其实是用php都读的数据库里的,结果把addsmall写错了,ft.多谢大伙了!changeparam是用来形成参数的,copy上来的时候删掉了,结果没删完,呵呵
#1
问题是什么呀?
#2
没有changeparam函数呀,呵呵,你的问题是什么?
#3
除了chenzengxi(懒猫)说的,还有2个问题
1。 function initselects()中
document.f1.s1.selectedIndex=0; ->document.f1.s2.selectedIndex=0;
2。 function initarrays()中
所有addsamll-> addsmall
呵呵,笔误
1。 function initselects()中
document.f1.s1.selectedIndex=0; ->document.f1.s2.selectedIndex=0;
2。 function initarrays()中
所有addsamll-> addsmall
呵呵,笔误
#4
<HTML>
<HEAD>
<SCRIPT language=javascript >
var bigkinds=new Array(0);
var bigvalue=new Array(0);
var kinds=new Array(0);
var values=new Array(0);
var big=0;
var small=0;
function init() {
initarrays();
initselects();
}
function findindex(seltemp,newvalue) {
for (var i=0;i<seltemp.length;i++)
if (seltemp.options[i].value==newvalue) break;
return i;
}
function changebig(newvalue) {
document.f1.s2.selectedIndex=findindex(document.f1.s2,newvalue);
big=newvalue;
// changeparam("BigkindProduct",newvalue); //不知道干啥
updates3(document.f1.s2.selectedIndex);
changesmall(document.f1.s3.options[0].value);
}
function changesmall(newvalue) {
document.f1.s3.selectedIndex=findindex(document.f1.s3,newvalue);
small=newvalue;
}
function initselects() {
document.f1.s2.options.length=0;
for (var i=0;i<bigkinds.length;i++) {
document.f1.s2.options.length++;
document.f1.s2.options[i].text=bigkinds[i];
document.f1.s2.options[i].value=bigvalue[i];
}
document.f1.s1.selectedIndex=0;
document.f1.s2.selectedIndex=1;
updates3(document.f1.s2.options[1].value-1);
}
function updates3(n) {
document.f1.s3.options.length=0;
for (var i=0;i<kinds[n].length;i++) {
document.f1.s3.options.length++;
document.f1.s3.options[i].text=kinds[n][i];
document.f1.s3.options[i].value=values[n][i];
}
document.f1.s3.selectedIndex=0;
}
function initarrays()
{
addbig("C语言概述",1);
addsamll(1,"C语言历史背景",1);
addsamll(1,"C语言特点",2);
addsamll(1,"简单的C程序介绍",3);
addsamll(1,"C程序的上机步骤",4);
addbig("数据类型、运算符与表达式",2);
addsamll(2,"C的数据类型",1);
addsamll(2,"常量与变量",2);
addsamll(2,"整型数据",3);
addsamll(2,"实型数据",4);
addsamll(2,"字符型数据",5);
addsamll(2,"变量赋初值",6);
addsamll(2,"各种数据类型间的混合运算",7);
addsamll(2,"算术运算符与算术表达式",8);
addsamll(2,"赋值运算符与赋值表达式",9);
addsamll(2,"逗号运算符与逗号表达式",10);
addbig("最简单的C程序设计",3);
addsamll(3,"C语句概述",1);
addsamll(3,"程序的三种基本结构",2);
addsamll(3,"赋值语句",3);
addsamll(3,"数据输出",4);
addsamll(3,"数据输入",5);
addsamll(3,"程序举例",6);
}
function addbig(disptext,newvalue) {
bigkinds.length++;
bigkinds[bigkinds.length-1]=disptext;
bigvalue.length++;
bigvalue[bigvalue.length-1]=newvalue;
kinds.length++;
kinds[kinds.length-1]=new Array(0);
values.length++;
values[values.length-1]=new Array(0);
}
function addsamll(n,disptext,newvalue) {
kinds[n-1].length++;
kinds[n-1][kinds[n-1].length-1]=disptext;
values[n-1].length++;
values[n-1][values[n-1].length-1]=newvalue;
}
</SCRIPT>
<TITLE>1111111</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="bjsoso.files/text.css" rel=stylesheet>
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">
<DIV align=center>
<TABLE id=AutoNumber1
style="BORDER-LEFT-WIDTH: 1px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 1px"
borderColor=#111111 cellSpacing=0 borderColorDark=#000000 cellPadding=0
width=375 bgColor=#c0c0c0 borderColorLight=#000000 border=0>
<TBODY>
<TR>
<TD style="BORDER-RIGHT: medium none; BORDER-LEFT: medium none" vAlign=top
width="100%" bgColor=#e7e7e7>
<FORM class=sfont name=f1
action=http://localhost/search.php
method=post><SPAN class=pt9>查询范围:</SPAN>
<SELECT class=pt9 onchange=changebig(this.options[this.selectedIndex].value) name=s2>
<OPTION value=1 selected>C语言概述</OPTION>
<OPTION value=2>数据类型、运算符与表达式</OPTION>
<OPTION value=3>最简单的C程序设计</OPTION>
</SELECT>
<SELECT class=pt9 onchange=changesmall(this.options[this.selectedIndex].value) name=s3>
<OPTION value=1 selected>C语言历史背景</OPTION><OPTION value=2>C语言特点</OPTION><OPTION value=3>简单的C程序介绍</OPTION><OPTION value=4>C程序的上机步骤</OPTION></SELECT><BR><BR>关键字: <INPUT
class=pt9 size=10 name=kw1> <INPUT type=radio CHECKED value=and name=rdb>
与 <INPUT type=radio value=or name=rdb> 或 <INPUT class=pt9 size=10
name=kw2> <INPUT class=pt9 type=submit value=" 搜 索 " name=submit></SPAN></FORM></TD></TR>
<TBODY></TBODY></TABLE>
<SCRIPT language=javascript>
init();
changebig(1);
changesmall(1);
</SCRIPT>
</DIV></BODY></HTML>
<HEAD>
<SCRIPT language=javascript >
var bigkinds=new Array(0);
var bigvalue=new Array(0);
var kinds=new Array(0);
var values=new Array(0);
var big=0;
var small=0;
function init() {
initarrays();
initselects();
}
function findindex(seltemp,newvalue) {
for (var i=0;i<seltemp.length;i++)
if (seltemp.options[i].value==newvalue) break;
return i;
}
function changebig(newvalue) {
document.f1.s2.selectedIndex=findindex(document.f1.s2,newvalue);
big=newvalue;
// changeparam("BigkindProduct",newvalue); //不知道干啥
updates3(document.f1.s2.selectedIndex);
changesmall(document.f1.s3.options[0].value);
}
function changesmall(newvalue) {
document.f1.s3.selectedIndex=findindex(document.f1.s3,newvalue);
small=newvalue;
}
function initselects() {
document.f1.s2.options.length=0;
for (var i=0;i<bigkinds.length;i++) {
document.f1.s2.options.length++;
document.f1.s2.options[i].text=bigkinds[i];
document.f1.s2.options[i].value=bigvalue[i];
}
document.f1.s1.selectedIndex=0;
document.f1.s2.selectedIndex=1;
updates3(document.f1.s2.options[1].value-1);
}
function updates3(n) {
document.f1.s3.options.length=0;
for (var i=0;i<kinds[n].length;i++) {
document.f1.s3.options.length++;
document.f1.s3.options[i].text=kinds[n][i];
document.f1.s3.options[i].value=values[n][i];
}
document.f1.s3.selectedIndex=0;
}
function initarrays()
{
addbig("C语言概述",1);
addsamll(1,"C语言历史背景",1);
addsamll(1,"C语言特点",2);
addsamll(1,"简单的C程序介绍",3);
addsamll(1,"C程序的上机步骤",4);
addbig("数据类型、运算符与表达式",2);
addsamll(2,"C的数据类型",1);
addsamll(2,"常量与变量",2);
addsamll(2,"整型数据",3);
addsamll(2,"实型数据",4);
addsamll(2,"字符型数据",5);
addsamll(2,"变量赋初值",6);
addsamll(2,"各种数据类型间的混合运算",7);
addsamll(2,"算术运算符与算术表达式",8);
addsamll(2,"赋值运算符与赋值表达式",9);
addsamll(2,"逗号运算符与逗号表达式",10);
addbig("最简单的C程序设计",3);
addsamll(3,"C语句概述",1);
addsamll(3,"程序的三种基本结构",2);
addsamll(3,"赋值语句",3);
addsamll(3,"数据输出",4);
addsamll(3,"数据输入",5);
addsamll(3,"程序举例",6);
}
function addbig(disptext,newvalue) {
bigkinds.length++;
bigkinds[bigkinds.length-1]=disptext;
bigvalue.length++;
bigvalue[bigvalue.length-1]=newvalue;
kinds.length++;
kinds[kinds.length-1]=new Array(0);
values.length++;
values[values.length-1]=new Array(0);
}
function addsamll(n,disptext,newvalue) {
kinds[n-1].length++;
kinds[n-1][kinds[n-1].length-1]=disptext;
values[n-1].length++;
values[n-1][values[n-1].length-1]=newvalue;
}
</SCRIPT>
<TITLE>1111111</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="bjsoso.files/text.css" rel=stylesheet>
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">
<DIV align=center>
<TABLE id=AutoNumber1
style="BORDER-LEFT-WIDTH: 1px; BORDER-COLLAPSE: collapse; BORDER-RIGHT-WIDTH: 1px"
borderColor=#111111 cellSpacing=0 borderColorDark=#000000 cellPadding=0
width=375 bgColor=#c0c0c0 borderColorLight=#000000 border=0>
<TBODY>
<TR>
<TD style="BORDER-RIGHT: medium none; BORDER-LEFT: medium none" vAlign=top
width="100%" bgColor=#e7e7e7>
<FORM class=sfont name=f1
action=http://localhost/search.php
method=post><SPAN class=pt9>查询范围:</SPAN>
<SELECT class=pt9 onchange=changebig(this.options[this.selectedIndex].value) name=s2>
<OPTION value=1 selected>C语言概述</OPTION>
<OPTION value=2>数据类型、运算符与表达式</OPTION>
<OPTION value=3>最简单的C程序设计</OPTION>
</SELECT>
<SELECT class=pt9 onchange=changesmall(this.options[this.selectedIndex].value) name=s3>
<OPTION value=1 selected>C语言历史背景</OPTION><OPTION value=2>C语言特点</OPTION><OPTION value=3>简单的C程序介绍</OPTION><OPTION value=4>C程序的上机步骤</OPTION></SELECT><BR><BR>关键字: <INPUT
class=pt9 size=10 name=kw1> <INPUT type=radio CHECKED value=and name=rdb>
与 <INPUT type=radio value=or name=rdb> 或 <INPUT class=pt9 size=10
name=kw2> <INPUT class=pt9 type=submit value=" 搜 索 " name=submit></SPAN></FORM></TD></TR>
<TBODY></TBODY></TABLE>
<SCRIPT language=javascript>
init();
changebig(1);
changesmall(1);
</SCRIPT>
</DIV></BODY></HTML>
#5
真是错误一大堆!!!
#6
这个程序也写的太繁琐了一点,其实不用这么麻烦的。
s2和s3里的OPTION其实都不用写进去,initselects()初始塞进去就行了.
还有数组可以用["name1",["name1","name2","name3"]]的方式,就根本不用那么多代码,转来转去不头晕才怪。
s2和s3里的OPTION其实都不用写进去,initselects()初始塞进去就行了.
还有数组可以用["name1",["name1","name2","name3"]]的方式,就根本不用那么多代码,转来转去不头晕才怪。
#7
hehe,sorry,我找了一下午没找到,3x,其实是用php都读的数据库里的,结果把addsmall写错了,ft.多谢大伙了!changeparam是用来形成参数的,copy上来的时候删掉了,结果没删完,呵呵