Home > Default > I have firefox 21.0. For some reason, it's not resizing html elements with Javascript. When I use getElementById, it ignores the changes I try to make.

I have firefox 21.0. For some reason, it's not resizing html elements with Javascript. When I use getElementById, it ignores the changes I try to make.

October 11Hits:0
Advertisement
I've tried resizing and repositioning the element with this code:
<pre><nowiki>widthPercentage = screen.availWidth / 800;
heightPercentage = (screen.availHeight / 600);
squareLeft = (124* widthPercentage);
squareTop = 202;
if (document.getElementById)
TEMPO = document.getElementById('SQUARE');
TEMPO.style.left = (124 * widthPercentage);
I've tried with this code:
squareTop = 202;
squareLeft = (124 * widthPercentage);
starterWidth = (495 * widthPercentage);
starterHeight = (99 * heightPercentage);
TEMPO = '<DIV ID="SQUARE" STYLE="position:absolute; left:squareLeft; top:squareTop; visibility:visible;">';
TEMPO += '<P>';
TEMPO += '<img name="screenTitle_box" ID="STARTER" src="ARTWORK/FRONT_SCREEN_TITLE_5.JPG" HEIGHT=starterHeight WIDTH=starterWidth>';
TEMPO += '</P>';
TEMPO += '</DIV>';
document.getElementById('SQUARE').innerHTML = TEMPO;
Neither way works. But the same code works in Internet Explorer.
Here's the element I'm trying to manipulate:
<DIV ID="SQUARE" STYLE="position:absolute; left:333px; top:10px; visibility:visible;">
<P>
<img name="screenTitle_box" ID="STARTER" src="ARTWORK/PICTURE_5.JPG" HEIGHT="150" WIDTH="900">
</P>
</DIV></nowiki></pre>

Answers

A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.
*http://forums.mozillazine.org/viewforum.php?f=25
The helpers at that forum are more knowledgeable about web development issues.<br>
You need to register at the MozillaZine forum site in order to post at that forum.

Read other 2 answers

Tags:

Related Articles

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 14 q. 0.670 s.