Click to See Complete Forum and Search --> : Date script deleting page content?


texasgurl
10-17-2003, 03:59 PM
I'm trying to insert a script which generates dates on a web page. Unfortunately, the code I copied into my page causes an entire table below it to be deleted. I know it must be the script because each time I insert it, the table disappears, but when I take it out and make no further changes, the table reappears.

Attached is the script as I found it in my friend's site, and it works there (http://www.deltatitleservices.com). I can't seem to make it work without erasing content in my site, however.

I don't have the code for my page on hand, but given this script, can anyone tell me why it might cause trouble with an HTML page created in DreamWeaver MX?

Thanks,
Jennifer

Charles
10-17-2003, 04:14 PM
There's a lot wrong with that script. Use instead...

<script type="text/javascript">
<!--
Date.prototype.toDateString = function () {return [this.getMonth() + 1, this.getDate(), this.getFullYear()].join ('/')}

document.write(new Date().toDateString());
// -->
</script>