如何将输入框 ( ) 中的值回显form name="form1"
到输入框 ( form name="form2"
)
我想出了如何在第一种形式中回显输入..以及在 div 中..但我不知道如何将输入从第一种形式的输入框 ( form1
).. 传递到输入框中在第二种形式 ( form2
) 中。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function FillBilling(f) {
f.billingname.value = f.shippingname.value;
f.billingcity.value = f.shippingcity.value;
}
function changeRadius1(){
var name_input = document.getElementById('name_input').value;
document.getElementById('radius1').innerHTML = name_input;
}
function changeRadius2(){
var city_input = document.getElementById('city_input').value;
document.getElementById('radius2').innerHTML = city_input;
}
</script>
</head>
<body>
<b>Mailing Address FORM1</b><br><br>
<form name="form1">
Name:<input type="text" name="shippingname" onkeyup="FillBilling(form1); changeRadius1()">
<br>City:<input type="text" name="shippingcity" onkeyup="FillBilling(form1); changeRadius2()">
<br><br>
Name:<input type="text" id="name_input" class="name_input" name="billingname" onkeyup="FillBilling(form2)"><br>
City:<input type="text" id="city_input" class="city_input" name="billingcity" onkeyup="FillBilling(form2)">
</form>
<br>
<P>
<b>Billing Address FORM2</b><br><br>
<form name="form2">
Name:<input type="text" id="name_input" class="name_input" name="billingname"><br>
City:<input type="text" id="city_input" class="city_input" name="billingcity">
</form>
<br><b>Billing Address TEXT</b><br><br>
<div class="yourcode">Name: <span id="radius1"></span></div>
<div class="yourcode">City: <span id="radius2"></span></div>
</body>
</html>
我希望这不是一个愚蠢的问题.. 答案应该很明显.. 但我在 JS 的开头.. 所以谢谢你的帮助。