无法使用步骤属性输入带小数的价格?

问题描述 投票:-1回答:1

我试图通过在HTML中使用step属性向sql发布价格。我已经尝试了step = any和step =“0.01”,并且我仍然只能输入整数。我已经在microsoft edge和Mozilla Firefox中测试了这个,结果相同。

这种方法不再起作用吗?到目前为止,我无法通过在线搜索找到任何其他明确的选项。是的,我对HTML有些新意。感谢任何帮助,谢谢。

<html>
<title>
Item Creation Form
</title>
<head>
</head>
<body>
<form action="insert-item.php" id="iteminsert" method="post">
    Title : <br> <input type="text" name="title"> <br>
    Price : <br> <input type="number" placeholder="0.00" step="any"       name="amount"> <br>
    Description :
</form>

<textarea name="desc" form="iteminsert" rows="4" cols="50"></textarea><br>
Category: <br>  <br>
<select name="category" form="iteminsert">
<option value="AUTO">Automobiles and Vehicles</option>
<option value="APPL">Appliances</option>
<option value="CLOT">Clothing and Accessories</option>
<option value="FURN">Furniture</option>
<option value="GAME">Games and Movies </option>
<option value="HOBB">Hobbies</option>
<option value="HOUS">Houses,Rooms,and Apartments</option>
<option value="INST">Instruments</option>
<option value="OTHE">Other</option>
<option value="OUTD">Outdoors</option>
<option value="SERV">Services</option>
<option value="TOOL">Tools</option>
</select> <br>  <br>
Image : <input type="file" form="iteminsert" name="image1">  <br>  <br>
Image 2 : <input form="iteminsert"  type="file" name="image2"> <br>  <br>
Image 3: <input form="iteminsert"  type="file" name="image3">  <br>  <br>
Image 4: <input form="iteminsert"  type="file" name="image4">  <br>  <br>

<input form="iteminsert"type="submit" value="Insert">
</body>
html
1个回答
0
投票

<form action="insert-item.php" id="iteminsert" method="post">
    Title : <br> <input type="text" name="title"> <br>
    Price : <br> <input type="number" placeholder="0.00" step="0.01"       name="amount"> <br>
    Description :
</form>

<textarea name="desc" form="iteminsert" rows="4" cols="50"></textarea><br>
Category: <br>  <br>
<select name="category" form="iteminsert">
<option value="AUTO">Automobiles and Vehicles</option>
<option value="APPL">Appliances</option>
<option value="CLOT">Clothing and Accessories</option>
<option value="FURN">Furniture</option>
<option value="GAME">Games and Movies </option>
<option value="HOBB">Hobbies</option>
<option value="HOUS">Houses,Rooms,and Apartments</option>
<option value="INST">Instruments</option>
<option value="OTHE">Other</option>
<option value="OUTD">Outdoors</option>
<option value="SERV">Services</option>
<option value="TOOL">Tools</option>
</select> <br>  <br>
Image : <input type="file" form="iteminsert" name="image1">  <br>  <br>
Image 2 : <input form="iteminsert"  type="file" name="image2"> <br>  <br>
Image 3: <input form="iteminsert"  type="file" name="image3">  <br>  <br>
Image 4: <input form="iteminsert"  type="file" name="image4">  <br>  <br>

<input form="iteminsert" type="submit" value="Insert">

这是工作代码,如果有,请检查并告知我任何其他要求。

您还可以使用min和max属性来确保输入的最小值和最大值


推荐问答