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