Click to See Complete Forum and Search --> : Problem with 'write' function


zbc
11-20-2004, 02:07 PM
I'm making a clandar all done in javascript, but I have a problem with is writing the date to my tables with 'getElementById'. If anyone could help that would be great.

Code:

document.getElementById("h").write(monthname[d.getMonth()])

Jona
11-20-2004, 02:14 PM
document.getElementById("h").firstChild.data = monthname[d.getMonth()];

zbc
11-20-2004, 02:18 PM
I tryed it, it didn't work. I'm not sure what i'm doing wrong.

Jona
11-20-2004, 02:33 PM
Do you get an error?

zbc
11-20-2004, 02:39 PM
Strangly enough I don't get any errors at all!:eek:

Jona
11-20-2004, 02:42 PM
You can try creating a new text node and replacing it with the old one using the DOM. The DOM code I posted should work, though. What browser are you using? If you're using Internet Explorer, can you try a different browser, such as Mozilla Firefox?

zbc
11-20-2004, 02:46 PM
Well I am using ie, and I could switch to firefox. But I not admin to my computer so I won't be able to.

zbc
11-20-2004, 02:58 PM
hmmmm. Do you think there could be some extensions for ie that would do what firefox would?

sciguyryan
11-20-2004, 03:39 PM
Well, MS have not made an update for thir scripting engine for a while so, you'll either have to wait for the next IE (With any luck FF will and should crush it so there will not be one) or, wait untill MS updates their script engine again.


RyanJ

zbc
11-20-2004, 04:12 PM
Well who knows how long that will take!

Hey I mite have a way to get firefox, but it will take a day or two. Thanks for all the help though.

Jona
11-20-2004, 04:45 PM
You could alternatively use "innerHTML," although that is proprietary scripting and I don't recommend it. The code I posted should work in IE as well as Firefox. If you don't get any errors, it may very well be a logical problem elsewhere in the script. Just a thought, though. Good luck.