Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox and "innerHTML" ??

Status
Not open for further replies.

Hannes214

IS-IT--Management
Jan 30, 2006
45
DE
Hi

i found a nice code for a calendar with events.
The problem is, that the code doesn't work in Firefox .

I get an error at the line: 118: kalender.innerHTML=l

can someone help me?

Code:

var farbe_zelle_monat="#00FF9F";
var farbe_zelle_vzm="#EEEBA4";
var zeichen_monat_a="<font size=+1><b><font color=\"#000000\">";
var zeichen_monat_e="<\/font><\/b><\/font>"

var zeichen_wochentage_a="<font size=+0><b><font color=\"#0000ff\">"
var zeichen_wochentage_e="<\/font><\/b><\/font>"

var farbe_wochentage_zelle="#00E0FF";
var farbe_sonntag_zelle="#F9BAFE";

var farbe_zelle_texte="#EEEBA4";

var zeichen_termine_a="<font size=+1><font color=\"#f09090\">";
var zeichen_termine_e="<\/font><\/font>"

var zeichen_popup_a="<font size=+2><font color=\"#f09090\">";
var zeichen_popup_e="<\/font><\/font>"

var popupbreite=300;
var popuphoehe=150
var dayarray=new Array("Mo","Di","Mi","Do","Fr","Sa","So")
var montharray=new Array("Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember")
var anztage=new Array(31,28,31,30,31,30,31,31,30,31,30,31)
var tag,monat,jahr,wtag,l,sc,i,u
heute()
function tag_heute() {
heute=new Date() ;
tag=heute.getDate()
monat=heute.getMonth() ;
jahr=heute.getYear()
if (jahr < 1000) {jahr+=1900}
return tag
}
function monat_heute() {
heute=new Date() ;
tag=heute.getDate()
monat=heute.getMonth() ;
jahr=heute.getYear()
if (jahr < 1000) {jahr+=1900}
return monat
}
function jahr_heute() {
heute=new Date() ;
tag=heute.getDate()
monat=heute.getMonth() ;
jahr=heute.getYear()
if (jahr < 1000) {jahr+=1900}
return jahr
}
function wtag_heute() {
heute=new Date() ;
wtag=heute.getDay()
return wtag
}
function heute() { ;
heute=new Date() ;
tag=heute.getDate() ;
monat=heute.getMonth() ;
wtag=heute.getDay() ;
jahr=heute.getYear() ;
if (jahr < 1000) {jahr+=1900}
}
function schaltjahr(n) {; //
var sj=(parseInt(n/4) == (n/4)) ?true : false;
if (parseInt(n/100) == (n/100)) {
if (parseInt(n/400) != (n/400)) {sj = false}
}
return sj
}
function wochentag(tag,monat,jahr) { ;
neuesdatum=new Date(jahr, monat, tag)
wtag=neuesdatum.getDay()
return wtag
}
function zeige_monat(monat2,jahr2) {
tag=tag_heute(), monat=monat2, jahr=jahr2
wtag=wochentag(1,monat,jahr)
if (wtag==0) {wtag = 7}
l="<html>\n<body>\n"
l=l+"<table BORDER=0 CELLSPACING=2 CELLPADDING=0 COLS=7 WIDTH=\"300\">\n"
l=l+"<tr>\n"
l=l+"<td BGCOLOR=\""+farbe_zelle_vzm+"\"><center><a href=\"javascript:monat_zurueck();zeige_monat(monat,jahr)\"><img src=\"kalimg/zurueck.gif\" border=0><\/a><\/center><\/td>\n"
l=l+"<td COLSPAN=\"5\" BGCOLOR=\""+farbe_zelle_monat+"\">\n"
l=l+"<center>"+zeichen_monat_a+montharray[monat]+" "+jahr+zeichen_monat_e+"<\/center>\n"
l=l+"<\/td>\n"
l=l+"<td BGCOLOR=\""+farbe_zelle_vzm+"\"><center><a href=\"javascript:monat_vor();zeige_monat(monat,jahr)\"><img src=\"kalimg/vor.gif\" border=0><\/a><\/center><\/td>\n"
l=l+"<\/tr>\n"
l=l+"<tr BGCOLOR=\""+farbe_wochentage_zelle+"\">\n"
for (i=0; i<7; i++) {
l=l+"<td"
if (i==6) {l=l+" BGCOLOR=\""+farbe_sonntag_zelle+"\""}
l=l+">\n"
l=l+"<center>"+zeichen_wochentage_a+dayarray+zeichen_wochentage_e+"<\/center>\n"
l=l+"<\/td>\n"
}
l=l+"<\/tr>\n"
tage=anztage[monat]
u=-wtag
if (monat==1 && schaltjahr(jahr)) {tage++}
l=l+"<tr>\n"
for (i=1; i<=38; i++) {
l=l+"<td ALIGN=CENTER"
if ((i+u)>0 && (i+u)<=tage) {
l=l+" BGCOLOR="+farbe_zelle_texte+">"
l=l+""+zeichen_wochentage_a;// +(i+u)+
if ((i+u)==tag && monat==heute.getMonth() && (jahr==heute.getYear() || jahr==heute.getYear()+1900)) {l=l+"<b><font color=\"#000000\">"+(i+u)+"<\/font><\/b>"} else {l=l+""+(i+u)+""}
l=l+zeichen_wochentage_e+"\n"
l=l+"<br><a href=\"javascript:zeige_termin("+(i+u)+")\"><img name=\"t"+(i+u)+"\" src=\"kalimg/trans.gif\" HSPACE=1 border=0><\/a><a href=\"javascript:zeige_geburtstag("+(i+u)+")\"><img name=\"g"+(i+u)+"\" src=\"kalimg/trans.gif\" HSPACE=1 border=0><\/a><a href=\"javascript:zeige_feiertag("+(i+u)+")\"><img name=\"f"+(i+u)+"\" src=\"kalimg/trans.gif\" HSPACE=1 border=0><\/a>"
} else {l=l+">"}
l=l+"<\/td>\n"
if ((i-1)/7==Math.floor((i-1)/7)) {l=l+"<\/tr>\n<tr>\n"}
}
l=l+"<\/tr>\n"
l=l+"<\/table>\n"
l=l+"<\/body><\/html>\n"
kalender.innerHTML=l
ueberpruefe_termine()
}

function monat_zurueck() {
monat--
if (monat<0) {
monat=11
jahr--
}}
function monat_vor() {
monat++
if (monat>11) {
monat=0
jahr++
}}
function ueberpruefe_termine() {; // termine usw in den kaleiner einbauen
for (i=0; i<ttag.length; i++) {
if ((ttype=="f" || ttype=="t") && (tjahr==jahr || tjahr==0) && tmonat==monat) {
document.images[ttype+ttag].src="kalimg/"+ttype+".gif"
}
if (ttype=="g" && tmonat==monat) {
document.images[ttype+ttag].src="kalimg/"+ttype+".gif"
}
}
}
function zeige_termin(u) {
for (i=0; i<ttag.length; i++) {
if (ttype=="t" && ttag==u && tmonat==monat && tjahr==jahr) {
var xsize = screen.width
var ysize = screen.height
var xpos=(xsize-popupbreite)/2
var ypos=(ysize-popuphoehe)/2
popup=window.open("","","scrollbars=no,status=no,toolbar=no,location=no,directories=no,resizable=no,menubar=no,width="+popupbreite+",height="+popuphoehe+",screenX="+xpos+",screenY="+ypos+",top="+ypos+",left="+xpos+",dependent=yes")
popup.document.write("<html>\n<head>\n<title>Termin<\/title>\n<body onblur=\"self.focus()\" background=\"kalimg/termin.gif\">\n")
popup.document.write("<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 COLS=1 WIDTH=\"100%\" HEIGHT=\"100%\" >\n")
popup.document.write("<tr>\n<td>\n<center>"+zeichen_popup_a+ttext+zeichen_popup_e+"<\/center><\/td><\/tr>\n")
popup.document.write("<tr>\n<td>\n")
if (tlink>"") {popup.document.write("<center><a href=\""+tlink+"\" target=\"_blank\"><img src=\"kalimg/link.gif\" border=0><\/a><\/center>")}
popup.document.write("<\/td>\n<\/tr>\n<\/table><\/center>\n")
popup.document.write("<\/body>\n<\/html>\n")
popup.document.close()
popup.document.focus
}
}
}
function zeige_geburtstag(u) {
for (i=0; i<ttag.length; i++) {
if (ttype=="g" && ttag==u && tmonat==monat) {
var xsize = screen.width
var ysize = screen.height
var xpos=(xsize-popupbreite)/2
var ypos=(ysize-popuphoehe)/2
popup=window.open("","","scrollbars=no,status=no,toolbar=no,location=no,directories=no,resizable=no,menubar=no,width="+popupbreite+",height="+popuphoehe+",screenX="+xpos+",screenY="+ypos+",top="+ypos+",left="+xpos+",dependent=yes")
popup.document.write("<html>\n<head>\n<title>Geburstag<\/title>\n<body onblur=\"self.focus()\" background=\"kalimg/geburtstag.gif\">\n")
popup.document.write("<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 COLS=1 WIDTH=\"100%\" HEIGHT=\"100%\" >\n")
popup.document.write("<tr>\n<td>\n<center>"+zeichen_popup_a+ttext+"<br>hat Geburtstag,<br>")
popup.document.write("und wird "+(jahr-tjahr)+" Jahre alt."+zeichen_popup_e+"<\/center><\/td><\/tr>\n")
popup.document.write("<tr>\n<td>\n")
if (tlink>"") {popup.document.write("<center><a href=\""+tlink+"\" target=\"_blank\"><img src=\"kalimg/link.gif\" border=0><\/a><\/center>")}
popup.document.write("<\/td>\n<\/tr>\n<\/table><\/center>\n")
popup.document.write("<\/body>\n<\/html>\n")
popup.document.close()
popup.document.focus
}
}
}
function zeige_feiertag(u) {
for (i=0; i<ttag.length; i++) {
if (ttype=="f" && ttag==u && tmonat==monat && (tjahr==jahr || tjahr==0)) {
var xsize = screen.width
var ysize = screen.height
var xpos=(xsize-popupbreite)/2
var ypos=(ysize-popuphoehe)/2
popup=window.open("","","scrollbars=no,status=no,toolbar=no,location=no,directories=no,resizable=no,menubar=no,width="+popupbreite+",height="+popuphoehe+",screenX="+xpos+",screenY="+ypos+",top="+ypos+",left="+xpos+",dependent=yes")
popup.document.write("<html>\n<head>\n<title>Feiertag<\/title>\n<body onblur=\"self.focus()\" background=\"kalimg/feiertag.gif\">\n")
popup.document.write("<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 COLS=1 WIDTH=\"100%\" HEIGHT=\"100%\" >\n")
popup.document.write("<tr>\n<td>\n<center>"+zeichen_popup_a+ttext+zeichen_popup_e+"<\/center><\/td><\/tr>\n")
popup.document.write("<tr>\n<td>\n")
if (tlink>"") {popup.document.write("<center><a href=\""+tlink+"\" target=\"_blank\"><img src=\"kalimg/link.gif\" border=0><\/a><\/center>")}
popup.document.write("<\/td>\n<\/tr>\n<\/table><\/center>\n")
popup.document.write("<\/body>\n<\/html>\n")
popup.document.close()
popup.document.focus
}
}
}

IT-Management
( FoxPro-Newbi :eek:) )
 
I get an error at the line: 118: kalender.innerHTML=l

Which error do you get? "Out of bananas"? "Too little height"? "Wrong colour pants!"?

Maybe it's "kalender is null or not an object", as kalender doesn't appear to be defined anywhere. If so, you should define it. If not, then perhaps you could help us out with a more exact error message.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
One thing to try, however:

If you have an element on the page with the name of "kalender", change the name to an ID. If you already have an element with an ID of "kalender", then change this line:

Code:
kalender.innerHTML=l

to this:

Code:
document.getElementById('kalender').innerHTML = l;

Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
The error is "kalender is null or not an object"..

but i'll try to change that line to "document.getElementById('kalender').innerHTML = l;"

thx

IT-Management
( FoxPro-Newbi :eek:) )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top