商品添加 - 添加商品信息
<p><%--
Created by IntelliJ IDEA.
User: User
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %></p>
<html>
<head>
<title>商品添加 - 添加商品信息</title>
</head>
<body>
<form action="/add" method="post">
<h2 style="text-align:center; color:peachpuff;">商品信息</h2>
<table cellpadding="0" border="1" align="center" style="background-color: yellow;">
<tr>
<td>编号</td>
<td><input type="text" name="id" value=""/></td>
</tr>
<tr>
<td>商品名</td>
<td><input type="text" name="gname" value=""/></td>
</tr>
<tr>
<td>商品种类</td>
<pre><code> <td>
<select name="gtype" onchange="showCustomType(this)">
<option value="蔬菜">蔬菜</option>
<option value="乳制品">乳制品</option>
<option value="肉蛋">肉蛋</option>
<option value="饮料">饮料</option>
<option value="零食">零食</option>
<option value="主食">主食</option>
<option value="自定义">自定义</option>
</select>
<input type="text" name="customType" style="display: none;">
</td>
</tr>
<tr>
<td>商品价格</td>
<td><input type="text" name="gprice" value=""/></td>
</tr>
<tr>
<td>单位</td>
<td>
<select name="danwei">
<option value="斤">斤</option>
<option value="袋">袋</option>
<option value="箱">箱</option>
<option value="包">包</option>
</select>
</td>
</tr>
<tr>
<td>更新时间</td>
<td><input type="date" name="shijian" value=""/></td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" value="添加"></td>
</tr>
</code></pre>
</table>
</form>
</body>
</html>
<script>
function showCustomType(select) {
var customTypeInput = select.parentNode.querySelector('input[name="customType"]');
if (select.value === "自定义") {
customTypeInput.style.display = "inline";
} else {
customTypeInput.style.display = "none";
}
}
</script>
原文地址: https://www.cveoy.top/t/topic/prhz 著作权归作者所有。请勿转载和采集!