I am creating a site using bootstrap to give weather updates at the beach. MY SITE
The following php script requests the correct image.
http://www.ntslf.org/files/php/pltdata_tgi.php?port=Liverpool&span=4&from=20130821
the last set of numbers is the date backwards.
Basically I want this image to update in the page and be the correct date. I tried using javascript but i couldn't get it to work
var var d = new Date();
var n = d.getDate();
here is the source code for the website:
<div class="col-lg-6">
<h3>Tides</h3>
<p>Tides over the next 2 days</p>
<img src="http://www.ntslf.org/files/php/pltdata_tgi.php?port=Liverpool&span=4&from=20130821" class="img-responsive" alt="Responsive image">
</a>
</div>
I can't work out how I would use javascript to change the img src to the correct date
EDIT I now have and i'm still unable to make it work
<div class="col-lg-6">
<h3>Tides</h3>
<p>Tides over the next 2 days</p>
<img src="http://www.ntslf.org/files/php/pltdata_tgi.php?port=Liverpool&span=4&from=20130821" class="img-responsive" alt="Responsive image">
<script>
var d = new Date();
var date = d.getFullYear() + '' + (d.getMonth()+1) + '' + d.getDate();
var image = document.getElementsByClass("img-responsive")[0];
image.src = 'http://www.ntslf.org/files/php/pltdata_tgi.php?port=Liverpool&span=4&from='+date;
</script>
</a>
</div>