javascript - Iframe URL variable update with Current Date in HTML page -
i have webpage query have multiple iframe content. on iframe url there date variable, required update current date automatically.can please let me know how , not using php. code is below:
<html> <head> </head> <body> 1. frame <iframe src="http://example.com/gui/v3/admin/oss/date'2015-06-15'/" border="0" style="width:100%; height:100%;"></iframe> 2. frame <iframe src="http://example1.com/gui/v3date'2015-06-15'/admin" border="0" style="width:100%; height:100%;"></iframe> 3. frame <iframe src="http://example2.com/explorer/index.html#/resources/network.action_set?modified_on%3e%20date('2015-06-09')" border="0" style="width:100%; height:100%;"></iframe> 4. frame <iframe src="http://example2.com/explorer/index.html#/resources/network.cell_set?modified_on%3e%20date('**2015-06-15**')" border="0" style="width:100%; height:100%;"></iframe> 5. <iframe src="http://example3.com/explorer/index.html#/resources/monitor.platform_alerts?form=%7b%date('2015-06-11')" border="0" style="width:100%; height:100%;"></iframe> </body> </html>
you can create iframes dynamically, via javascript. e.g:
var d = new date(), year = d.getfullyear(), month = d.getmonth() + 1, day = d.getdate(), today = year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day); document.body.innerhtml = ('<iframe src="http://example.com/gui/v3/admin/oss/date\'__date__\'/" border="0" style="width:100%; height:100%;"></iframe>' + '<iframe src="http://10.65.152.4:5000/gui/v3/admin/oss/vmumuas3x/" border="0" style="width:100%; height:100%;"></iframe>' + '<iframe src="http://example2.com/explorer/index.html#/resources/network.action_set?modified_on%3e%20date(\'__date__\')" border="0" style="width:100%; height:100%;"></iframe>' + '<iframe src="http://example2.com/explorer/index.html#/resources/network.cell_set?modified_on%3e%20date(\'**__date__**\')" border="0" style="width:100%; height:100%;"></iframe>' + '<iframe src="http://example3.com/explorer/index.html#/resources/monitor.platform_alerts?form=%7b%date(\'__date__\')" border="0" style="width:100%; height:100%;"></iframe>').replace(/__date__/g, today);
Comments
Post a Comment