【发布时间】:2015-02-17 20:15:22
【问题描述】:
我可以给一些 js 建议吗?
我希望在选中相关复选框之前隐藏数量(数量)文本框。
if else 之类的功能会很棒,我不希望表单的位置移动,而只是显示 qty 文本框。
这是一个非评分项目,我还在学习,我只学习了 8 周,每周 2.5 小时的课程,js 不是我的强项。如果你能得到,我绝对不介意将价格乘以在添加第一个数量之前隐藏的数量以及选择选项的运行总计。
谢谢....
http://codepen.io/anon/pen/PwRoGd
HTML:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<title>Test Practice V3 - Order</title>
<link rel="stylesheet" href="stylehomepage.css">
<script src="script.js"></script>
</head>
<body>
<div id="ocontainer">
<div id="buttons">
<div id="homebutton">
<a href="index.html">home</a>
</div>
<div id="menubutton">
<a href="menu.html">menu</a>
</div>
<div id="orderbutton">
<a href="order.html">order</a>
</div>
<div id="fbackbutton">
<a href="feedback.html">feedback</a>
</div>
</div>
<div id="content">
<br>
<br>
<form>
<legend><b>Chips:</b></legend>
<select name="chips" onchange="calculateTotal()">
<option value="None">Select Size</option>
<option value="XS">X-Small ($2)</option>
<option value="S">Small ($3)</option>
<option value="M">Medium ($4)</option>
<option value="L">Large ($5)</option>
<option value="XL">X-Large ($6)</option>
</select>
</form>
<br>
<br>
<table>
<tr class="cboxtable">
<th> </th>
<th><b>Snack:</b></th>
<th><b>Price:</b></th>
<th><b>Quantity:</b></th>
</tr>
<tr>
<td class="cboxtable">
<form>
<input type="checkbox" name="calamari">
</form></td>
<td>Calamari (10 Pieces)</td>
<td>$6.50</td>
<td>
<form>
<input type="text" size="10" name="calamariqty">
</form>
</td>
</tr>
</table>
<br>
<br>
<form>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
</div>
</div>
</div>
</body>
</html>
CSS:
body {
background-image:url(Images/Water%20Image.jpg);
background-attachment:fixed;
background-repeat:no-repeat;
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
#container {
width: 80%;
height: 800px;
background-color: #FFF;
margin-left: auto;
margin-right: auto;
margin-top: 100px;
margin-bottom: 20px;
box-shadow: 10px 10px 20px #333;
border-radius: 30px;
padding:20px;
}
#ocontainer {
width: 80%;
height: 100%;
background-color: #FFF;
margin-left: auto;
margin-right: auto;
margin-top: 100px;
margin-bottom: 20px;
box-shadow: 10px 10px 20px #333;
border-radius: 30px;
padding:20px;
}
#buttons {
height:50px;
width:85%;
background-color:#FFF;
margin-left:auto;
margin-right:auto;
}
#homebutton {
height: 100%;
width: 23.5%;
float: left;
background-color: #FFF;
border-radius: 15px;
margin-right:2%;
}
#menubutton {
height:100%;
width:23.5%;
float:left;
background-color:#FFF;
border-radius: 15px;
margin-right:2%;
}
#orderbutton {
height:100%;
width:23.5%;
float:left;
background-color:#FFF;
border-radius: 15px;
margin-right:2%;
}
#fbackbutton {
height:100%;
width:23.5%;
float:left;
background-color:#FFF;
border-radius: 15px;
}
a {
display:block;
text-decoration: none;
text-transform: uppercase;
color:black;
font-size:18px;
height:50px;
width:100%;
margin-right:0;
margin-left:0px;
text-align:center;
line-height:50px;
}
#homebutton:hover {
background-color:#00BBFF;
}
#menubutton:hover {
background-color:#00BBFF;
}
#orderbutton:hover {
background-color:#00BBFF;
}
#fbackbutton:hover {
background-color:#00BBFF;
}
#content {
width: 95%;
height: 80%;
padding-top:30px;
padding: 10px;
margin-left:auto;
margin-right:auto;
font-size:16px;
}
table {
width:65%;
}
tr {
text-align:left;
}
cboxtable {
max-width:50px;
}
th {
font-size:18px;
}
legend {
font-size:18px;
}
option {
font-size:16px;
}
【问题讨论】:
标签: javascript jquery html css