PDA

View Full Version : on Button Click change date



shyamsalat
04-27-2007, 03:20 PM
on my webpage everyday change image though computer date i want to put one button for cange date with preivous day date image

image change javascript is

var j,d="",l="",m="",p="",q="",z="",KW_ARI= new Array()
var oneDay=60*60*24*1000, d=new Date();jk=d.getTimezoneOffset()*60*1000;
KW_ARI[KW_ARI.length]='/dailydarshan/2007/april/th_nn_26.JPG?&width=100&height=75';
KW_ARI[KW_ARI.length]='/dailydarshan/2007/april/th_nn_27.JPG?&width=100&height=75&alt=Shree%20Nar%20Narayan%20Dev&title=Shree%20Nar%20Narayan%20Dev';
KW_ARI[KW_ARI.length]='/dailydarshan/2007/april/th_nn_28.JPG?&width=100&height=75&alt=Shree%20Nar%20Narayan%20Dev&title=Shree%20Nar%20Narayan%20Dev';
KW_ARI[KW_ARI.length]='/dailydarshan/2007/april/th_nn_29.JPG?&width=100&height=75&alt=Shree%20Nar%20Narayan%20Dev&title=Shree%20Nar%20Narayan%20Dev';
KW_ARI[KW_ARI.length]='/dailydarshan/2007/april/th_nn_30.JPG?&width=100&height=75&alt=Shree%20Nar%20Narayan%20Dev&title=Shree%20Nar%20Narayan%20Dev';
KW_ARI[KW_ARI.length]='/dailydarshan/2007/april/th_nn_25.JPG?&width=100&height=75&alt=Shree%20Nar%20Narayan%20Dev&title=Shree%20Nar%20Narayan%20Dev';
j=(parseInt((d.getTime()-jk)/oneDay))%KW_ARI.length;
j=(isNaN(j))?0:j;
if (KW_ARI[j].indexOf('?')==-1) {
document.write("<img src='"+KW_ARI[j]+"'>");
}
else {
nvp=KW_ARI[j].substring(KW_ARI[j].indexOf('?')+2).split('&');
for(var i=0;i<nvp.length;i++) {
sub=nvp[i].split('=');
switch(sub[0]) {
case 'link':
l="<a href='"+unescape(sub[1])+"'>";
p="</a>";
break;
case 'target':
q=" target='"+unescape(sub[1])+"'";
break;
default:
m+=" "+sub[0]+"='"+unescape(sub[1])+"'";
break;
}
}
z=(l!="")?((q!="")?l.substring(0,l.length-1)+q+">":l):"";
z+="<img src='"+KW_ARI[j].substring(0,KW_ARI[j].indexOf('?'))+"'"+m+">"+p;
document.write(z);
}

Link www.shrihari.org/dailydarshan/Index.html