PDA

View Full Version : Trouble with changing DOM properties in FF. Need quick help!



jlizarraga
04-07-2008, 05:46 PM
I'm still pretty new to Javascript - surely there is some basic idea I'm missing here. I'm using the following code to change the width and height of a div, but Firefox doesn't want to play ball - only IE changes the width and height of the mainImageFrame div when this function is run:


function changeZoom(width,height) {
window.resizeTo(width+270,height+150);
document.getElementById("mainImageFrame").style.width=width;
document.getElementById("mainImageFrame").style.height=height;
}

Here is an example link:

<a href="javascript:void(0);" onclick="changeZoom(640,480)">640x480</a>

Firefox changes the window size to the specified size, but not the div. IE changes both. This function is just the latest iteration of my attempt to get the div to resize, so if I should be approaching this another way by all means let me know. I R NEWBIE!

jlizarraga
04-07-2008, 06:03 PM
I found the answer! Thanks to anyone who was looking at my issue.

The correct code was:


function changeZoom(width,height) {
window.resizeTo(width+270,height+150);
document.getElementById("mainImageFrame").style.width=width+"px";
document.getElementById("mainImageFrame").style.height=height+"px";
}

I hates you, IE. Making me think you were doing something right for once. >_>