Experiment No. 05: Develop The Javascript To Implement Strings

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Experiment No.

05
Develop the JavaScript to implement strings.

CODE:
<html>
<head>
<script type="text/javascript">
var p = /student/i;
function test() {
var str = textfield.value;
if (p.test(str)) {
alert("The string " + str + " contain the given pattern");
}
else {
alert("The string " + str + " does not contain the given pattern");
}
}
</script> </head> <body><h3>check string</h3>
Enter the string <input type="text" id="textfield" />
<input type="button" value="Check" onclick="test();" />
</body>
</html>

OUTPUT:

You might also like