Javascript/javascript logic

Advertisement


Harshad Raval wrote at 2013-02-25 04:43:42
Simple program for Palindrome::

,

,



<html>

<body>

Developed By - Harshad Raval (CS-1137)</br></br>

<script type="text/javascript">

 function Palindrome() {

  var revStr = "";

  var str = document.getElementById("str").value;

  var i = str.length;

  for(var j=i; j>=0; j--) {

     revStr = revStr+str.charAt(j);

  }

  if(str == revStr) {

     alert(str+" :is Palindrome");

  } else {

     alert(str+" :is not a Palindrome");

  }

}

</script>

<form >

 Enter a String/Number: <input type="text" id="str" name="string" /><br />

 <input type="submit" value="Check" onclick="Palindrome();"/>

</form>

</body>

</html>


Javascript

All Answers


Ask Experts

Volunteer


Randy L. Taylor

Expertise

I can answer advanced questions concerning most aspects of web programming including HTML, DHTML, DOM, JavaScript, Cookies, Internet Explorer, and CSSs. I can answer basic questions concerning XML and ActiveX. I can also answer questions concerning Regular Expressions, logical design algorithms, and Object Oriented Programming.

Experience


Past/Present clients
Upp Business Systems, LLC
Headquarters Standard Systems Group, USAF

©2016 About.com. All rights reserved.