Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Set parameters of iframe using Java Script


Fotiman - 2:33 pm on Jan 18, 2012 (gmt 0)



<iframe id="mapFrame" src="">
<script>
var clientDate = new Date(),
yyyy = clientDate.getFullYear(),
mm = (clientDate.getMonth() + 1), // getMonth returns 0 - 11
dd = clientDate.getDate(),
iframeEl = document.getElementById('mapFrame');
iframeEl.src = "http://www.#*$!x.com/cgi-bin/map/3dayxc.cgi?date=" +
yyyy +
(mm < 10? "0" + mm: mm) +
(dd < 10? "0" + dd: dd) +
"&amp;date_fcast=" +
yyyy +
(mm < 10? "0" + mm: mm) +
(dd < 10? "0" + dd: dd) +
"_03&amp;lat=-23.95628&amp;lon=150.266667&amp;units=ft&amp;windunits=kph&amp;offset=10";
</script>


Does that work? Note, users with JavaScript disabled will not get the same results. Also, this uses the date at the client (which could be anything), so may not produce accurate results. This is probably better handled with server side code (PHP, ASP, etc.).

Welcome to WebmasterWorld.


Thread source:: http://www.webmasterworld.com/javascript/4408027.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com