ASP-kode i JavaScript
Hej,Kan det lade sig gøre at indsætte nogle dynamiske dato i en js-fil? Jeg bruger ASP - skal udtrække nogle datoer for mærkedage i en JS-kalender.... (tjek længere nede hvor løkken skal være)
agenda.js:
---------------------------------------------------------
function fAppendEvent(y, m, d, message, action, bgcolor, fgcolor, bgimg, boxit, html) {
var ag=fGetEvent(y,m,d);
if (ag==null) fAddEvent(y, m, d, message, action, bgcolor, fgcolor, bgimg, boxit, html);
else fAddEvent(y, m, d, message?ag[0]+"\n"+message:ag[0], action?action:ag[1], bgcolor?bgcolor:ag[2], fgcolor?fgcolor:ag[3], bgimg?bgimg:ag[4], boxit?boxit:ag[5], ag[6]+html);
}
// DETTE SKAL GØRES DYNAMISK vha ASP - DER SKAL VÆRE EN LØKKE OMKRING DET - DB-UDTRÆK
fAppendEvent(2003,3,28," March 28, 2003 \n Click to detect calendar size. ","alert('Here is the current size of the calendar - \"width='+gfSelf.offsetWidth+' height='+gfSelf.offsetHeight+'\"');","#AA0034","#FFFFFF");
// SLUT PÅ LØKKE
fAppendEvent(2002,12,14," Click the sub events for details... ","",null,null,"OS13.jpg",false,"<div align=left class='MsgBoard' onmousedown='alert(\"Dining for what I like!\")'>18:00 dinner</div>");
fAppendEvent(2002,12,14,"",null,null,null,null,null,"<div align=left class='MsgBoard' onmousedown='alert(\"Party for what we like!\")'>20:00 party</div>");
function fHoliday(y,m,d) {
var r=fGetEvent(y,m,d); // get agenda event.
if (r) return r; // ignore the following holiday checking if the date has already been set by the above addEvent functions. Of course you can write your own code to merge them instead of just ignoring.
// you may have sophisticated holiday calculation set here, following are only simple examples.
if (m==1&&d==1)
r=[" Jan 1, "+y+" \n Godt Nytår! ", "alert('Godt Nytår!')", null, null, "dots.gif", false, "<div align=left class='MsgBoard'>Godt Nytår!</div>"];
else if (m==12&&d==25)
r=[" Dec 25, "+y+" \n Merry X'mas! ", null, null, null, "Holiday.jpg"]; // show a line-through effect
else if (m==5&&d>20) {
var date=getDateByDOW(y,5,5,1); // Memorial day is the last Monday of May
if (d==date) r=["May "+d+", "+y+" Luder-dag ", gsAction, "#004955", "white"]; // use default action
}
return r; // if r is null, the engine will just render it as a normal day.
}
// slut på fil