/* first position in the string is 0! */ <html> <body>
<script type="text/javascript">
var str="JavaScript is great!" var pos=str.indexOf("great") if (pos>=0){ document.write("great found at position: ") document.write(pos + "<br>") }else{ document.write("great not found!") }
</script> </body> </html>
Related Scripts with Example Source Code in same category :