【发布时间】:2009-11-17 09:32:19
【问题描述】:
我创建了两个表。第一个是邮寄地址(邮寄街道、城市等)。第二个表是送货地址。这些字段与邮寄地址几乎相同。让我们假设送货地址与邮寄地址相同。如何创建一个单选按钮,将第一个表中的数据复制到第二个表中?
用户输入的数据将保存在 MySQL 数据库中。
谁能告诉我如何做到这一点?到目前为止,这是我尝试过的:
<script type="text/javascript">
function data_copy(){
if(document.form1.copy[0].checked){
document.form1.txtmailing_add2.value=document.form1.txtmailing_add1.value; document.form1.Address.txtother_street.value=document.form1.Address.txtmailing_street.value;
document.form1.Address.txtother_city.value=document.form1.Address.txtmailing_city.value; document.form1.Address.txtother_state.value=document.form1.Address.txtmailing_state.value;
document.form1.Address.txtother_postcode.value=document.form1.Address.txtmailing_postcode.value; document.form1.Address.txtother_country.value=document.form1.Address.txtmailing_country.value;
}
else{
document.form1.Address.txtmailing_add2.value="";
document.form1.Address.txtother_street.value="";
document.form1.Address.txtother_city.value="";
document.form1.Address.txtother_state.value="";
document.form1.Address.txtother_postcode.value="";
document.form1.Address.txtother_country.value="";
}
}
</script>
<form name=form1 method=post action="">
</form>
【问题讨论】:
-
我认为,您可以在单击单选按钮时使用 javascript,将邮寄地址的值传递给送货地址并将值存储在表中
-
我尝试使用 javascript 来解决它。但没有工作。
-
ok 然后检查 onSubmit 中的条件。如果选中复选框或选项框,则将邮寄地址的值添加到两个表中。
-
我上传了我的代码 d.可以帮mw看看,觉得我需要改什么?
标签: javascript html mysql