Professional Documents
Culture Documents
Practical No-12
Practical No-12
develop web page for validation of form fields using regular expression.
<html>
<head>
<script type="text/javascript">
function TestString(str)
re=/[az]/;
if(re.test(str))
else{
</script>
<script type="text/javascript">
TestString(input_str);
</script>
</html>
Output-
program no -2
<html>
<head>
<script type="text/javascript">
function TestString(input_str){
re=/[^0-9]/;
if(re.test(input_str))
else{
</script>
</head>
<body>
<script type="text/javascript">
TestString(input_str);
</script>
</body>
</html>
Output-
program no-3
<html>
<script type="text/javascript">
function TestString(str){
document.write("<em>"+str+"</em>"+"<br/>");
var i=str.match(/[1234][A-Z]{2}\d{2}[A-Z]{2}\d{3}/);
if(i==null)
return false;
else
return true;}
<h3>
<script type="text/javascript">
if(TestString(input_str))
</script>
</h3>
</html>
Output-