0

I am totally new to javascript & I have a challenge from my professor due tonight to create a web page that shows the last three days' worth of pictures in a folder I have.

My professor is mean and won't help me & I'm digging through StackOverflow archives and keep finding similar things, but not exactly what I am trying to do.

If you can help, I will appreciate it.

I have 10 pictures.. all named by their dates (07072016.jpg, 07062016.jpg, 07052016.jpg, etc.). I'd like to display them in three rows (and yes - I looked on W3 and know to use and . But what I can't find is how to dynamically just show the last three dates.

I know logically what steps I'd need to take (get today's date from some function, break it apart, reassemble it so that it's MMddYYYY and then tack on ".jpg" at the end), but no idea how to do it in javascript (or anything else that I could put in my html shell.

Please help. Thanks.

  • 1
    You should show what code you have and have tried so far. That'll get more people to help you, otherwise no one wants to do everything for you. – Ale Jul 07 '16 at 17:27
  • Good call. Well I saw this (below) and thought I could use something similar.. var hour = new Date().getHours(); if (hour < 9 || hour > 18) { //set image through url } else { //set another image through url } but is there a getday(), getmonth(), and getyear()? Then can I concatenate them in a string somehow to create monthdayyear.jpg? – Kayla Mason-Manning Jul 07 '16 at 17:32
  • *got that from this post: http://stackoverflow.com/questions/27406958/how-to-change-background-image-by-time-of-day-without-page-refresh – Kayla Mason-Manning Jul 07 '16 at 17:36
  • 1
    Please edit your original question with the code that you have attempted, and what you are trying to do. Talking about how mean your professor can be is completely unwelcome here. – Dbz Jul 07 '16 at 18:28
  • I'm not sure how to post my code.. the guide says to put in four spaces and I tried, but it shows up blank. My code is just the basic html shell so far. from looking at other html pages with javascript embedded, it seems like I just use it within the tag of my html shell. what I want to do within there is similar to above (my attempt below).. Var day = new date().getDay(); Var Month=new date().getMonth(); Var Year=new date().getYear(); var imagefilestring= concatenate(month,day,year,".jpg) – Kayla Mason-Manning Jul 07 '16 at 18:47

0 Answers0