HTML DOM Input Search type 属性
htmlweb developmentfront end technology更新于 2024/5/28 11:56:17
HTML DOM Input Search type 属性与 type="search" 的输入元素关联。它将始终返回输入搜索元素的搜索。
语法
以下是 Input Search type 的语法 −
searchObject.type
示例
让我们看一个 Input Search type 属性的示例 −
<!DOCTYPE html>
<html>
<body>
<h1>Search type property</h1>
<form>
FRUITS: <input type="search" id="SEARCH1" name="fruits">
</form>
<p>Get the above element type by clicking the below button</p>
<button onclick="getType()">Get Type</button>
<p id="Sample"></p>
<script>
function getType() {
var t = document.getElementById("SEARCH1").type;
document.getElementById("Sample").innerHTML = "The type for the input field is : "+t;
}
</script>
</body>
</html>
输出
这将产生以下输出 −

点击"获取类型"按钮 −

相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

