Friday, 21 December 2012

assignments in recursion

1)write a C program to find the sum of the 'N' numbers using Recursion?
2)Write a C program to find the reverse of a number using Recursion?
output: Enter a number 123
Reverse of a number 321
3)Write a C program to find the binary of a given integer
number using recursion?

onchange event and onmouseover event

<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> function cimage() { var iname=document.getElementById("simage").value; var ifile=iname+".jpg"; document.getElementById("myimg").src=ifile; } function rollimage() { document.getElementById("myimg").src="Winter.jpg"; } </SCRIPT> </HEAD> <BODY> <center> <SELECT ID="simage" onchange="cimage();"> <OPTION VALUE="Blue_hills">Blue hills</OPTION> <OPTION VALUE="Sunset">Sunset</OPTION> <OPTION VALUE="Water_lilies">Water lilies</OPTION> <OPTION VALUE="Winter">Winter</OPTION> </SELECT> <img height="200" id="myimg" onmouseover="rollimage();" src="Blue_hills.jpg" width="200"/> </center> </BODY> </HTML>

onblur event

<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> function checkSize() { var myname= document.getElementById("tname").value; if(myname.length < 6) { alert("Name should be atleast 6 characters"); } } </SCRIPT> </HEAD> <BODY> <FORM METHOD=POST ACTION=""> Enter your Name:<INPUT TYPE="text" id="tname" onblur="checkSize();"/> <br> Age:<INPUT TYPE="text" id="tage"/> </FORM> </BODY> </HTML>

Photo Album example using arrays in javascript

<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"> var iarray=new Array("Desert.jpg","Hydrangeas.jpg","Jellyfish.jpg", "Lighthouse.jpg","Sunset.jpg","Winter.jpg"); var current=0; function next() { if(current == (iarray.length -1)) current=0; else current++; document.getElementById("photo").src=iarray[current]; } function previous() { if(current == 0) current=iarray.length -1; else current--; document.getElementById("photo").src=iarray[current]; } </SCRIPT> </HEAD> <BODY> <center> <img height="300" id="photo" src="Desert.jpg" width="300"/></br></br> <hr> <INPUT TYPE="button" VALUE="Previous" ONCLICK="previous();"> <INPUT TYPE="button" VALUE="Next" ONCLICK="next();"> </center> </BODY> </HTML>