На первый случай:
<div id="frame"></div>
function frame(a, b){
var frame1 = '<iframe src="https://calendar.google.com/calendar/embed?showTitle=0&showNav=0&showPrint=0&am p;showTabs=0&showCalendars=0&height=400&am p;wkst=1&bgcolor=%23FFFFFF&src=21dlbguih2d el97p562nusrkgo%40group.calendar.google.com&co lor=%23182C57&ctz=Asia%2FJerusalem;dates=';
var frame2 = '" style="border-width:0" width="600" height="400" frameborder="0" scrolling="no"></iframe>';
var result = frame1 + a + '%' + b + frame2;
var frameID = document.getElementById('frame');
frameID.innerHTML = result;
}
frame('20171001', '20171031');