HTML DOM Input Submit type 属性

htmlweb developmentfront end technology更新于 2024/5/28 7:40:17

HTML DOM Input Submit type 属性与 type="submit"的输入元素关联。对于输入提交元素,它将始终返回 submit。

语法

以下是提交类型属性 − 的语法

submitObject.type

示例

让我们看一个Input Submit type 属性的示例 −

<!DOCTYPE html>
<html>
<body>
<h1>Input range type Property</h1>
<form>
VOLUME <input type="range" id="RANGE1" name="VOL">
</form>
<p>Get the above input element type by clicking the below button</p>
<button type="button" onclick="rangeType()">GET Type</button>
<p id="Sample"></p>
<script>
   function rangeType() {
      var P=document.getElementById("RANGE1").type;
      document.getElementById("Sample").innerHTML = "The type for the input field is: "+P ;
   }
</script>
</body>
</html>

输出

这将产生以下输出 −

点击“GET Type”按钮 −


相关文章


有用资源