I have a JS file from which I want to call an html file and put it in an iframe. In html, to get it to work, I use:
<iframe src="WebPage1.html"
frameborder="0"
marginheight="0"
marginwidth="0"
width="100%"
height="100%"
scrolling="auto"
</iframe>
I am looking for how I would make a similar call within the JS file. This is the code in the JS file:
document.addEventListener('keydown',function(e){
//SHIFT + something
if(e.altKey){
switch(e.code){
case 'KeyB':
window.location = "http://www.mysite1.com"; <--- I want to call this using iframe
break;
case 'KeyC':
window.location = "http://www.mysite2.com"; <--- I want to call this using iframe
break;
case 'KeyT':
window.location = "http://www.mysite3.com"; <--- I want to call this using iframe
break;
case 'KeyW':
window.location = "http://www.mysite4.com"; <--- I want to call this using iframe
break;
}
}