I need to change the height of an iframe when clicked. The iframe is created with this code:
var box = document.createElement('iframe');
box.id = "statasa";
box.setAttribute('onclick', 'getmap()');
box.src = 'http://www.mysite.com/map.php';
box.frameBorder = 1;
box.style.border = 1;
box.style.overflow = 'hidden';
box.style.cursor = 'pointer';
box.style.width = '300px';
box.style.height = '720px';
box.style.position = 'absolute';
document.getElementsByTagName('body')[0].appendChild(box);
And this is the function:
function getmap() {
d = document.getElementById('statasa');
d.style.width="150px";
d.style.height="150px";
}
Where is the error? Are there simpler methods?