This is default featured post 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured post 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Showing posts with label Java Script. Show all posts
Showing posts with label Java Script. Show all posts

Wednesday, 28 December 2011

Add New Year Count Down To Blog

Year 2012 is pretty very near so let us add New Year widget that shows how many days, hours, minutes and seconds are left celebrate New Year 2012. One thing that I have noticed in most of the widgets is that, it displays a message when it reaches its target. Like on 01.01.2012 my widget will display " Wish You all a Very Prosporous and Happy New Year".

This widget uses a simple javascript to display count down based on the Users system time.

Happy New Year Count Down Demo.

How To Add New Year Count Down Demo To Blog.
1. Go to Design Tab in your Blog > Page Element Tab.
2. Click on "add a widget" then select "HTML/Javascript" Widget.
3.Paste below Javascript code to it.

<div id="bp_count_down_div"></div>
<script language="JavaScript">
var bp_date_target = new Date("January 1, 2012 00:00:00");
var bp_date_now = new Date();
var bp_count_down_complete_message = "Wish You all a Very Prosporous and Happy New Year";
if (bp_date_now >= bp_date_target) {
 document.getElementById("bp_count_down_div").innerHTML = bp_count_down_complete_message;
} else {
 bp_time_difference = Math.floor(((bp_date_target - bp_date_now).valueOf()) / 1000);
 display_time_difference(bp_time_difference);
}
function display_time_difference(bp_time_difference) {
 if (bp_time_difference <= 0) {
 document.getElementById("bp_count_down_div").innerHTML = bp_count_down_complete_message;
 return;
 }
 bp_count_down_message = bp_format_seconds(bp_time_difference, 86400, 100000) + " Days " + bp_format_seconds(bp_time_difference, 3600, 24) + " Hours " + bp_format_seconds(bp_time_difference, 60, 60) + " Minutes " + bp_format_seconds(bp_time_difference, 1, 60) + " Seconds for New Year";
 document.getElementById("bp_count_down_div").innerHTML = bp_count_down_message;
 setTimeout("display_time_difference(" + (bp_time_difference - 1) + ")", 1000);
}
function bp_format_seconds(secs, num1, num2) {
 num = ((Math.floor(secs / num1)) % num2).toString();
 if (num.length < 2) s = "0" + num;
  return "<b>" + num + "</b>";
}

</script>

4. Save your widget and view your Blog.

Monday, 3 October 2011

Java Script Image Slider


Java Script Image Slider

Step 1:
Insert the below into the <head> section of your page:

<script language="JavaScript1.1">
var slideimages=new Array()
var slidelinks=new Array()
function slideshowimages(){
for (i=0;i<slideshowimages.arguments.length;i++){
slideimages[i]=new Image()
slideimages[i].src=slideshowimages.arguments[i]
}}
function slideshowlinks(){
for (i=0;i<slideshowlinks.arguments.length;i++)
slidelinks[i]=slideshowlinks.arguments[i]
}
function gotoshow(){
if (!window.winslide||winslide.closed)
winslide=window.open(slidelinks[whichlink])
else
winslide.location=slidelinks[whichlink]
winslide.focus()
}
</script>


Step 2: Insert the below into the <body> section of your page where you wish the slideshow to appear:

<a href="javascript:gotoshow()"><img src="webihawk1.jpg" name="slide" border=0 width=300 height=375></a>
<script>
<!--


//configure the paths of the images, plus corresponding target links
slideshowimages("webihawk1.jpg","webihawk2.jpg","webihawk3.jpg","webihawk4.jpg","webihawk5.jpg")
slideshowlinks("http://webihawk.com/","http://webihawk.com/","http://webihawk.com/","http://webihawk.com/","http://webihawk.com/")


//configure the speed of the slideshow, in miliseconds
var slideshowspeed=2000


var whichlink=0
var whichimage=0
function slideit(){
if (!document.images)
return
document.images.slide.src=slideimages[whichimage].src
whichlink=whichimage
if (whichimage<slideimages.length-1)
whichimage++
else
whichimage=0
setTimeout("slideit()",slideshowspeed)
}
slideit()


//-->
</script>

Twitter Delicious Facebook Digg Stumbleupon Favorites More