Display buttons with custom styles and functionality
by rayray0093
HTML
<fieldset>
<label for="name">姓名:</label><input id="name" type="text">
<button class="button" onclick="orderFunction()">我要訂購</button>
<button class="button" onclick="aboutFunction()">關於我們</button>
</fieldset>
CSS
.name {
padding: 5px;
border: 2px solid black;
}
fieldset {
padding: 20px;
width: 200px;
height: auto;
border-radius: 5px;
border: 2px black solid;
/* background-color: black; */
text-align: center;
margin: 0 auto;
margin-top: 110px;
}
.button {
border: 2px solid black;
border-radius: 5px;
color: black;
background-color: white;
margin: 10px;
padding: 10px;
font-family: Arial, Helvetica, sans-serif;
}
.button:hover {
background-color: lightblue;
color: black;
border-color: white;
}
JavaScript
function orderFunction () {
const name = document.getElementById("name").value
alert (name+';'+'謝謝您對我們的衣服有興趣!請致電 0987-654-321,會有專人提供您報價!');
}
function aboutFunction () {
alert ('我們工廠位於新北市,通過國際 ISO9001 認證,品質讓您放心!');
}