Restar fecha
Hola, tengo el siguiente javascript que me muestra un iframe cada día, lo que yo quiero hacer es poder mostrar el iframe correspondiente a 2, 3 o 4 días atrás:
var ie=document.all
var dom=document.getElementById
var iframeprops='width=600 height=865 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"'
var daycontent=new Array()
daycontent[1]="01.php"
daycontent[2]="02.php"
daycontent[3]="03.php"
daycontent[4]="04.php"
daycontent[5]="05.php"
daycontent[6]="06.php"
daycontent[7]="07.php"
daycontent[8]="08.php"
daycontent[9]="09.php"
daycontent[10]="10.php"
daycontent[11]="11.php"
daycontent[12]="12.php"
daycontent[13]="13.php"
daycontent[14]="14.php"
daycontent[15]="15.php"
daycontent[16]="16.php"
daycontent[17]="17.php"
daycontent[18]="18.php"
daycontent[19]="19.php"
daycontent[20]="20.php"
daycontent[21]="21.php"
daycontent[22]="22.php"
daycontent[23]="23.php"
daycontent[24]="24.php"
daycontent[25]="25.php"
daycontent[26]="26.php"
daycontent[27]="27.php"
daycontent[28]="28.php"
daycontent[29]="29.php"
daycontent[30]="30.php"
daycontent[31]="31.php"
if (ie||dom)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')
var mydate=new Date()
var mytoday=mydate.getDate()
function dayofmonth_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? Document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=daycontent[mytoday]
}
}
window.onload=dayofmonth_iframe
var ie=document.all
var dom=document.getElementById
var iframeprops='width=600 height=865 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"'
var daycontent=new Array()
daycontent[1]="01.php"
daycontent[2]="02.php"
daycontent[3]="03.php"
daycontent[4]="04.php"
daycontent[5]="05.php"
daycontent[6]="06.php"
daycontent[7]="07.php"
daycontent[8]="08.php"
daycontent[9]="09.php"
daycontent[10]="10.php"
daycontent[11]="11.php"
daycontent[12]="12.php"
daycontent[13]="13.php"
daycontent[14]="14.php"
daycontent[15]="15.php"
daycontent[16]="16.php"
daycontent[17]="17.php"
daycontent[18]="18.php"
daycontent[19]="19.php"
daycontent[20]="20.php"
daycontent[21]="21.php"
daycontent[22]="22.php"
daycontent[23]="23.php"
daycontent[24]="24.php"
daycontent[25]="25.php"
daycontent[26]="26.php"
daycontent[27]="27.php"
daycontent[28]="28.php"
daycontent[29]="29.php"
daycontent[30]="30.php"
daycontent[31]="31.php"
if (ie||dom)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')
var mydate=new Date()
var mytoday=mydate.getDate()
function dayofmonth_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? Document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=daycontent[mytoday]
}
}
window.onload=dayofmonth_iframe
1 Respuesta
Respuesta de mangelgarcia
1