Sunday, October 23, 2022

String Palindrome in JavaScript

 A program that I wrote using JavaScript, CSS, and HTML to ask the user to give a string and then the program will check if the given string is a palindrome or not.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


You can buy my C++ book online at  


https://www.mindshaperspublishing.com/product/beginners-guide-to-c-programming/


You can buy my book in introduction to computer networking at 

https://www.unlimitedbooksph.com/product-page/introduction-to-computer-networking


Want to support my channel?

GCash Account

Jake Pomperada


09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.






Program Listing

index.htm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Language" content="en-us" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>String Palindrome in JavaScript</title> <style type="text/css"> .style1 { font-family: Arial; font-size: x-large; color: #FFFFFF; } .style3 { font-family: Arial; font-size: large; color: #FFFFFF; } .style4 { font-size: medium; } .style5 { font-family: Arial; } .style6 { font-size: large; } .style7 { margin-bottom: 0px; } .style8 { font-weight: bold; } </style> </head> <body bgcolor="#00FF00"> <hr /> <p class="style1"><strong>String Palindrome in JavaScript</strong></p> <p class="style3"><strong>Created By Jake R. Pomperada, MAED-IT, MIT</strong></p> <hr /> <p class="style3"><strong>Give a String&nbsp;&nbsp;&nbsp; </strong> <span class="style4"><span class="style5"><span class="style6"> <input name="Text1" type="text" style="width: 252px; height: 29px" id= "pa" required/></span></span></span></p> <form method="post" class="style3"> <strong>Result&nbsp; </strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="style4"><span class="style5"><span class="style6"> <input name="Text2" type="text" style="width: 252px; height: 29px" class="style7" id = "pa2" /></span></span></span></form> <p class="style3"> <strong><span class="style6"> <input name="Button1" type="button" onclick = "palindrome()" value="Check" style="width: 133px; height: 45px" class="style8" /></span></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="Button2" type="button" onclick = "ClearFields()" value="Clear" style="width: 133px; height: 45px" class="style8" /></p> <script type = "text/javascript"> // Written By Jake Rodriguez Pomperada, MAED-IT, MIT function palindrome() { var a= document.getElementById("pa").value; var b = ""; for (i = a.length-1; i >= 0; i--) { b = b + a[i] } var empt = document.getElementById("pa").value; if (empt == "") { alert("Please input a string"); document.getElementById("pa").focus(); } else { if (a.toUpperCase() == b.toUpperCase()) document.getElementById("pa2"). value = b.toUpperCase() + " is a Palindrome String "; else document.getElementById("pa2"). value = b.toUpperCase() + " is not a Palindrome String"; } } function ClearFields() { document.getElementById("pa").value =""; document.getElementById("pa2").value =""; document.getElementById("pa").focus(); } </script> </body> </html>

No comments:

Post a Comment