<html>
<body>
<p>Click the button to search a string for "W3Schools", and display the position of the match.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var str = "Visit W3Schools!";
var n = str.search("W3Schools");
document.getElementById("demo").innerHTML = n;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_search by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:01:38 GMT -->
</html>