I am trying to create an external JS sheet to have the function of the billing address being filled in with the values in the shipping address when the checkbox is clicked. I cannot change the code. Here is my code. What is the correct syntax to get the information to copy and erase with the click of the checkbox?
<!DOCTYPE html><html lang="en">
<head>
<meta charset="UTF-8">
<title>Shipping and Billing</title>
<script src = "form.js"></script>
<style>
input{
border:1px solid black;
}
input:focus{
background-color: #E6E6E6;
}
fieldset{
margin-bottom: 4%;
}
</style>
</head>
<body>
<h1>JavaScript Homework</h1>
<p>Add the JavaScript code needed to enable auto-complete on this form. Whenever the checkbox is checked, the code should automatically copy the values from Shipping Name and Shipping Zip into the Billing Name and Billing Zip. If the checkbox is unchecked, the Billing Name and Billing Zip should go blank.</p>
<form>
<fieldset>
<legend>Shipping Information</legend>
<label for ="shippingName">Name:</label>
<input type = "text" name = "shipName" id = "shippingName" required><br/>
<label for = "shippingzip">Zip code:</label>
<input type = "text" name = "shipZip" id = "shippingZip" pattern = "[0-9]{5}" required><br/>
</fieldset>
<input type="checkbox" id="same" name="same" onchange= "billingFunction()"/>
<label for = "same">Is the Billing Information the Same? </label>
<fieldset>
<legend>Billing Information</legend>
<label for ="billingName">Name:</label>
<input type = "text" name = "billName" id = "billingName" required><br/>
<label for = "billingzip">Zip code:</label>
<input type = "text" name = "billZip" id = "billingZip" pattern = "[0-9]{5}" required><br/>
</fieldset>
<input type = "submit" value = "Verify"/>
</form>
Aucun commentaire:
Enregistrer un commentaire