Tuesday, February 3, 2015

Palindrome JavaScript Program (for beginners)

<html>
<body>
<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>

Fibonacci Series JavaScript Program (for beginners)

<html>
<body>
<script type="text/javascript">
var a=0,b=1,c;
document.write("Fibonacci");
while (b<=10)
{
document.write(c);
document.write("<br/>");
c=a+b;
a=b;
b=c;
}
</script>
</body>
</html>

Monday, February 2, 2015

Hello in Javascript

<HTML>
<HEAD>
<TITLE> Hello World in Javascript </TITLE>
</HEAD>
<BODY>
<h2>Example 1</h2>

<script language="Javascript">
// Hello in Javascript


// display prompt box that ask for name and 
// store result in a variable called who
var who = window.prompt("What is your name");

// display prompt box that ask for favorite color and 
// store result in a variable called favcolor
var favcolor = window.prompt("What is your favorite color");

// write "Hello" followed by person' name to browser window
document.write("Hello " + who);

// Change background color to their favorite color
document.bgColor = favcolor;

</script>


</BODY>
</HTML>

CSS 3D Solar System

Javascript A study creating performant particles with Canvas 2D.

Javascript Function beautiful floating hello world notice

Javascript Space Puppy