/    Sign up×
Community /Pin to ProfileBookmark

Date script deleting page content?

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 ([url]http://www.deltatitleservices.com[/url]). 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

[upl-file uuid=f9b307d9-4a52-4caf-a8cb-a4d5e22e6413 size=1kB]date_script.txt[/upl-file]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@CharlesOct 17.2003 — [font=georgia]There's a lot wrong with that script. Use instead...[/font]

[font=monospace]<script type="text/javascript">

<!--

Date.prototype.toDateString = function () {return [this.getMonth() + 1, this.getDate(), this.getFullYear()].join ('/')}

document.write(new Date().toDateString());

// -->

</script>[/font]
×

Success!

Help @texasgurl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...