0
我需要更改點擊時iframe的高度。 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";
}
哪裏錯誤?有更簡單的方法嗎?
您不能單擊「IFRAME」,減少它的寬度和高度,因爲......它會影響其子元素。 – Rajiv007