Changing iframe src with Javascript
In this case, it's probably because you are using the wrong brackets here:
document.getElementById['calendar'].src = loc;
should be
document.getElementById('calendar').src = loc;
Maybe this can be helpful... It's plain html - no javascript:
<p>Click on link bellow to change iframe content:</p>
<a href="http://www.bing.com" target="search_iframe">Bing</a> -
<a href="http://en.wikipedia.org" target="search_iframe">Wikipedia</a> -
<a href="http://google.com" target="search_iframe">Google</a> (not allowed in inframe)
<iframe src="http://en.wikipedia.org" width="100%" height="100%" name="search_iframe"></iframe>
By the way some sites do not allow you to open them in iframe (security reasons - clickjacking)