0% found this document useful (0 votes)
81 views2 pages

JavaScript Practical No 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views2 pages

JavaScript Practical No 3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

JavaScript Practical No - 3

<!DOCTYPE html>
<html>
<head>
<title>Creating a program to check the entered number is
palindrome or not.</title>
<script>
function fun1() {
var mStr = form1.txt.value;
var mStr1 = mStr.toUpperCase();
var mStr2 = "";
var mL = mStr1.length - 1;
for (i = mL; i >= 0; i--) {
mStr2 = mStr2.concat(mStr1.charAt(i));
}
if (mStr1 == mStr2) {
document.getElementById("demo").innerHTML = mStr + " is a
palindrome word";
} else {
document.getElementById("demo").innerHTML = mStr + " is NOT
a palindrome word";
}
}
</script>
</head>
<body>
<h1>Check the Entered string is palindrome or not.</h1>
<form name="form1">
Enter some String : <input type="text" name="txt">
<br><br>
<input type="button" value="Submit" onclick="fun1()">
<p id="demo"></p>
</form>
</body>
</html>
Output:

You might also like