试了很久,自己不行额,还得求助下,怎么写提取的过程
<script language="javascript">
//表单提交按钮点击事件
function order_Click()
{
var tmpTotal="";//记录总价格变量
//累加总价
tmpTotal+=getSelRValue(document.doublecombo.cpu);//获得选中的cpu的价格加入总价格
tmpTotal+=getSelRValue(document.doublecombo.memory);//获得选中的内存的价格加入总价格
tmpTotal+=getSelRValue(document.doublecombo.HardDiscs);//获得选中的硬盘的价格加入总价格
tmpTotal+=getSelRValue(document.doublecombo.host);//获得选中的机箱的价格加入总价格
//将计算结果放入表单的隐藏控件中
document.doublecombo.TotalPrice.value=tmpTotal;
document.doublecombo.submit();//提交表单
}
//获得选中的单选框组的值
//参数多选框组名称
function getSelRValue(ObjRad)
{
var tTotal="";
for(var i=0;i<ObjRad.length;i++)
{
if(ObjRad[i].checked)
tTotal+=ObjRad[i].value+",";
}
return tTotal;
}
</script><form method="get" action="order.asp" name="doublecombo" id="form1">
<select name="example" size="1" style="width:180px" onChange="redirect(this.options.selectedIndex)" ID="Select1">
<option>请选择CPU厂商</option>
<option>intel</option>
<option>AMD</option>
</select>
<select name="cpu" size="1" style="width:180px" onChange="getSelRValue(ObjRad);" ID="Select2">
<option value="1000|型号1">intel型号1</option>
<option value="900|型号2">intel型号2</option>
<option value="800|型号3">AMD型号3</option>
<option value="700|型号4">AMD型号4</option>
</select><script>
<!--
/*
Double Combo Script Credit
By Website Abstraction (www.)
Over 200+ free JavaScripts here!
*/
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("intel型号1","1000|型号1")
group[0][1]=new Option("intel型号2","900|型号2")
group[0][2]=new Option("AMD型号3","800|型号3")
group[0][3]=new Option("AMD型号4","700|型号4")
group[1][0]=new Option("intel型号1","1000|型号1")
group[1][1]=new Option("intel型号2","900|型号2")
group[2][0]=new Option("AMD型号3","800|型号3")
group[2][1]=new Option("AMD型号4","700|型号4")
var temp=document.doublecombo.cpu
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>
<input type="checkbox" name="memory" value="200|1*512MB">
1*512MB<input type="checkbox" name="memory" value="400|1*1GB">
1*1GB<input type="checkbox" name="HardDiscs" value="200|40GB">40GB<input type="checkbox" name="HardDiscs" value="400|80GB">80GB<input type="checkbox" name="HardDiscs" value="800|160GB">160GB<input type="checkbox" name="HardDiscs" value="1000|250GB">250GB<input type="checkbox" name="host" value="200|2级机箱">2级机箱<input type="button" name="order" onClick="order_Click();" value="查看" /><input type="reset" name="reset" value="重选" />
<input type="hidden" name="TotalPrice" >
</form>
//表单提交按钮点击事件
function order_Click()
{
var tmpTotal="";//记录总价格变量
//累加总价
tmpTotal+=getSelRValue(document.doublecombo.cpu);//获得选中的cpu的价格加入总价格
tmpTotal+=getSelRValue(document.doublecombo.memory);//获得选中的内存的价格加入总价格
tmpTotal+=getSelRValue(document.doublecombo.HardDiscs);//获得选中的硬盘的价格加入总价格
tmpTotal+=getSelRValue(document.doublecombo.host);//获得选中的机箱的价格加入总价格
//将计算结果放入表单的隐藏控件中
document.doublecombo.TotalPrice.value=tmpTotal;
document.doublecombo.submit();//提交表单
}
//获得选中的单选框组的值
//参数多选框组名称
function getSelRValue(ObjRad)
{
var tTotal="";
for(var i=0;i<ObjRad.length;i++)
{
if(ObjRad[i].checked)
tTotal+=ObjRad[i].value+",";
}
return tTotal;
}
</script><form method="get" action="order.asp" name="doublecombo" id="form1">
<select name="example" size="1" style="width:180px" onChange="redirect(this.options.selectedIndex)" ID="Select1">
<option>请选择CPU厂商</option>
<option>intel</option>
<option>AMD</option>
</select>
<select name="cpu" size="1" style="width:180px" onChange="getSelRValue(ObjRad);" ID="Select2">
<option value="1000|型号1">intel型号1</option>
<option value="900|型号2">intel型号2</option>
<option value="800|型号3">AMD型号3</option>
<option value="700|型号4">AMD型号4</option>
</select><script>
<!--
/*
Double Combo Script Credit
By Website Abstraction (www.)
Over 200+ free JavaScripts here!
*/
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("intel型号1","1000|型号1")
group[0][1]=new Option("intel型号2","900|型号2")
group[0][2]=new Option("AMD型号3","800|型号3")
group[0][3]=new Option("AMD型号4","700|型号4")
group[1][0]=new Option("intel型号1","1000|型号1")
group[1][1]=new Option("intel型号2","900|型号2")
group[2][0]=new Option("AMD型号3","800|型号3")
group[2][1]=new Option("AMD型号4","700|型号4")
var temp=document.doublecombo.cpu
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>
<input type="checkbox" name="memory" value="200|1*512MB">
1*512MB<input type="checkbox" name="memory" value="400|1*1GB">
1*1GB<input type="checkbox" name="HardDiscs" value="200|40GB">40GB<input type="checkbox" name="HardDiscs" value="400|80GB">80GB<input type="checkbox" name="HardDiscs" value="800|160GB">160GB<input type="checkbox" name="HardDiscs" value="1000|250GB">250GB<input type="checkbox" name="host" value="200|2级机箱">2级机箱<input type="button" name="order" onClick="order_Click();" value="查看" /><input type="reset" name="reset" value="重选" />
<input type="hidden" name="TotalPrice" >
</form>
上面是我自己文件里的,试了很久,不懂弄,笨点,嘿,求助,求助哦
[[it] 本帖最后由 wellvps 于 2008-12-10 17:17 编辑 [/it]]