Play Flash Games


© 2007 Red Computer

HTML Howto, CSS Howto, JavaScript Howto, PHP Howto, Windows Howto
Google

Search String


There .search() function in JavaScript to find some string in string. This example function will show how to use it :

<script type="text/javascript">
function searchString() {
    if (document.form1.text1.value.search(/z/) != -1) { 
		alert('Yes ! "z" in entered.') 
	}
}
</script>

Type string here and you'll get alert when you type "z" :<br>
<form name=form1>
    <input type=text name=text1 size=50 onKeyup="searchString();">
</form>

This is the result :
Type string here and you'll get alert when you type "z" :

Replace "z" to whatever string you want.



Visitor's Comment

Post a Comment
Comment
Name :
E-mail :

HOME | HTML | CSS | JavaScript | PHP | XML | SQL | Virus Fix | Windows | Downloads | Links