By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,255 Members | 1,701 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,255 IT Pros & Developers. It's quick & easy.

On This Date...

P: n/a
How does one write JavaScript code for an image of something that happened
or appeared on this date? For example, today (as I'm writing this) is
October 2nd, and I would like to have an image of something that happened on
October 2nd.
-- John Lund
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"John Lund" <jo******@jml1965.com> wrote in
news:_E******************@nwrdny01.gnilink.net:
How does one write JavaScript code for an image of something that
happened or appeared on this date? For example, today (as I'm writing
this) is October 2nd, and I would like to have an image of something
that happened on October 2nd.

<script>
function two(x) {return ((x>9)?"":"0")+x}
d = new Date();
img = "happened"+two(getMonth(d)+1)+two(getDate(d))+".jp g"
document.write("<img src='"+img+"'>")
// This shows the image "happened1002.jpg" on your date
</script>

not tested!
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.