검색 사용 사용자가 검색 필드에 작성하고 ENTER 또는 x를 누를 때 스크립트를 실행하는 HTML의 속성
예시
다음 코드를 실행하여 onsearch를 구현할 수 있습니다. 속성 -
<!DOCTYPE html>
<html>
<body>
<p>Search something and press ENTER.</p>
<input type = "search" id="inputID" onsearch = "display()">
<p><strong>Note:</strong> It won' work in Internet Explorer and Firefox.</p>
<p id="test"></p>
<script>
function display() {
var a = document.getElementById("inputID");
document.getElementById("test").innerHTML = "Searched for - " + a.value;
}
</script>
</body>
</html>