单击时我需要更改 iframe 的高度。iframe 是使用以下代码创建的:
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);
这是功能:
function getmap() {
d = document.getElementById('statasa');
d.style.width="150px";
d.style.height="150px";
}
错误在哪里?有没有更简单的方法?