Non e` chaira la domanda, ma prova a mettere += al posto di = e vedi se e` quello che chiedevi.
Ciao
Michele
Non e` chaira la domanda, ma prova a mettere += al posto di = e vedi se e` quello che chiedevi.
Ciao
Michele
Nuova politica di maggiore severita` sui titoli delle discussioni: (ri)leggete il regolamento
No domande tecniche in messaggi privati
ora somma, ma rimane un problema, devo sostituire i document.wrie con il document.getElementById('dennis').innerHTML+=
pero mi succede un casiono perchè il document.write costruiva una tabella!!!
magari te lo posto così come potrebbe essere modificato ecco qui:
function cal1()
{
monthnames = new Array(
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December");
var linkcount=0;
function addlink(month, day, href) {
var entry = new Array(3);
entry[0] = month;
entry[1] = day;
entry[2] = href;
this[linkcount++] = entry;
}
Array.prototype.addlink = addlink;
linkdays = new Array();
monthdays = new Array(12);
monthdays[0]=31;
monthdays[1]=28;
monthdays[2]=31;
monthdays[3]=30;
monthdays[4]=31;
monthdays[5]=30;
monthdays[6]=31;
monthdays[7]=31;
monthdays[8]=30;
monthdays[9]=31;
monthdays[10]=30;
monthdays[11]=31;
todayDate=new Date();
thisday=todayDate.getDay();
thismonth=todayDate.getMonth();
thisdate=todayDate.getDate();
thisyear=todayDate.getYear();
thisyear = thisyear % 100;
thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear));
if (((thisyear % 4 == 0)
&& !(thisyear % 100 == 0))
||(thisyear % 400 == 0)) monthdays[1]++;
startspaces=thisdate;
while (startspaces > 7) startspaces-=7;
startspaces = thisday - startspaces + 1;
if (startspaces < 0) startspaces+=7;
document.getElementById('dennis').innerHTML="<tabl e border=2 bgcolor=white bordercolor=black><font color=black><tr><td colspan=7><center>"+ monthnames[thismonth] + " " + thisyear
+ "</center></font></td></tr>";
document.getElementById('dennis').innerHTML+="<tr> <td align=center>Su</td><td align=center>M</td><td align=center>Tu</td><td align=center>W</td><td align=center>Th</td><td align=center>F</td><td align=center>Sa</td></tr><tr>";
for (s=0;s<startspaces;s++) {
document.getElementById('dennis').innerHTML+="<td> </td>";
}
count=1;
while (count <= monthdays[thismonth]) {
for (b = startspaces;b<7;b++) {
linktrue=false;
document.getElementById('dennis').innerHTML+="<td> ";
for (c=0;c<linkdays.length;c++) {
if (linkdays[c] != null) {
if ((linkdays[c][0]==thismonth + 1) && (linkdays[c][1]==count)) {
document.getElementById('dennis').innerHTML+="<a href=\"" + linkdays[c][2] + "\">";
linktrue=true;
}
}
}
if (count==thisdate) {
document.getElementById('dennis').innerHTML+="<fon t color='FF0000'>";
}
if (count <= monthdays[thismonth]) {
document.getElementById('dennis').innerHTML+=(coun t);
}
else {
document.getElementById('dennis').innerHTML+=" ";
}
if (count==thisdate) {
document.getElementById('dennis').innerHTML+="</font>";
}
if (linktrue)
document.getElementById('dennis').innerHTML+="</a></td>";
count++;
}
document.getElementById('dennis').innerHTML+="</tr><tr>";
startspaces=0;
}
document.getElementById('dennis').innerHTML+="</table></p>";
}
</script>
geragef nan ga def?
allora... provo a spiegarti una cosa...
ccon getElementById() tu recuperi un elemento tramite l'ID che è sempre UNIVOCO
cioè significa che dennis è un contenitore, nel quale tu vai a inserire del testo tramite innerHTML. l'ID puoi anche settarlo a un pezzo di tabella... prova così per esempio
<table>
<tr>
<td id="dennis"></td>
</tr>
</table>
ricorda, l'ID è univoco, quindi se vuoi fare + scritte, devi usare + id.... tipo:
document.getElementById('dennis').innerHTML="Primo "
document.getElementById('dennis2').innerHTML="Seco ndo"
vdocument.getElementById('dennis3').innerHTML="Ter zo"
forse la risposta di prima nn serve perchè avevo capito un altra cosa..
se devi costruire una tabella il meccanismo è lo stesso del document.write... con la somma
document.getElementByID('dennis').innerHTML="<tabl e>"
document.getElementByID('dennis').innerHTML+="<tr> "
document.getElementByID('dennis').innerHTML+="<td> Ciao</td>"
document.getElementByID('dennis').innerHTML+="</tr>"
document.getElementByID('dennis').innerHTML+="</table>
ovviamente non devi fare un aggiunta per ogni cosa che vuoi mettere... puoi anche attaccare tutto
document.getElementByID('dennis').innerHTML="<tabl e><tr><td>Ciao</td></tr></table>"
![]()
ora provo, grazie tante...
geragef nan ga def?