Javascript Essentials Part 4


Rotation

Image Rotation (Page Reload or Refresh Based)
<SCRIPT LANGUAGE="Javascript"> function image() {
};
image = new image();
number = 0;
// imageArray
image[number++] = "<img src='images/1u.gif' border='0'>"
image[number++] = "<img src='images/2u.gif' border='0'>"
image[number++] = "<img src='images/3u.gif' border='0'>"
image[number++] = "<img src='images/4u.gif' border='0'>"
image[number++] = "<img src='images/5u.gif' border='0'>"
image[number++] = "<img src='images/6u.gif' border='0'>"
image[number++] = "<img src='images/7u.gif' border='0'>"
image[number++] = "<img src='images/8u.gif' border='0'>"
image[number++] = "<img src='images/9u.gif' border='0'>"
image[number++] = "<img src='images/10u.gif' border='0'>"
image[number++] = "<img src='images/11u.gif' border='0'>"
image[number++] = "<img src='images/12u.gif' border='0'>"
image[number++] = "<img src='images/13u.gif' border='0'>"
image[number++] = "<img src='images/14u.gif' border='0'>"
image[number++] = "<img src='images/15u.gif' border='0'>"
image[number++] = "<img src='images/16u.gif' border='0'>"
image[number++] = "<img src='images/17u.gif' border='0'>"
image[number++] = "<img src='images/18u.gif' border='0'>"
image[number++] = "<img src='images/19u.gif' border='0'>"
image[number++] = "<img src='images/20u.gif' border='0'>"
image[number++] = "<img src='images/21u.gif' border='0'>"
// keep adding items here...
increment = Math.floor(Math.random() * number);
document.write(image[increment]);
</SCRIPT>
Text Rotation (Page Reload or Refresh Based)
<SCRIPT LANGUAGE="Javascript">
function makeQuote() {
if((navigator.userAgent.indexOf("Mozilla/3.0") != -1) ||
(navigator.userAgent.indexOf("MSIE")!= -1)) {
Quotes = new Array();
Quotes[0] = "\"Whatever good(O man!) happens to thee is from Allah;\<BR>but whatever evil happens to thee is from thy(own)soul.";
Quotes[1] = "\And we have sent thee as an Apostle to (instruct) mankind;\<BR>and enough is Allah for a witness.";
Quotes[2] = "\Freedom without discipline;\<BR>is a disastrous.";
Quotes[3] = "\We must know that life is difficult,if we know and\<BR>accept it, it is no longer dificult.";
Quotes[4] = "\Instead of worrying about things and events that you can't control,\<BR>start focusing on things u can control.";
Quotes[5] = "\Know that u are a miracle yourself\<BR>and are empowered to do miracles.";
Quotes[6] = "\Problems and uncertainties\<BR>keep the life going.";
Quotes[7] = "\Throw the word impossible out of\<BR>ur dictionary.Never ever give up.";
Quotes[8] = "\You can be anything, you want ,\<BR>if u are willing to pay its price.";
Quotes[9] = "\You can be anything\<BR>but not everything."; var x = Math.floor(Quotes.length * Math.random());
document.writeln(Quotes[x]);
}
}
</SCRIPT>
<SCRIPT LANGUAGE="javascript">
makeQuote();
</SCRIPT>
Image Rotation (Daily)
<!-- Paste this code into the BODY of your HTML document -->
<SCRIPT LANGUAGE="JavaScript">
today = new Date();
day = today.getDay();
arday = new Array("sunday.jpg", "monday.jpg", "tuesday.jpg", 
"wednesday.jpg", "thursday.jpg", "friday.jpg", "saturday.jpg");
document.write("<img src='" + arday[day] + "'>");
</SCRIPT>
Image Rotation (After some seconds) – Appear

Image rotation by java script. Image changes after some seconds.

Download Image Transition Effect Using Javascript

Image Rotation (After some seconds) – Fade in out

Download Image Transition Fade In out Effect

Related Posts


1 thought on “Javascript Essentials Part 4

Leave a Reply

Your email address will not be published. Required fields are marked *