Hi all,
I am new to this forum and javascript. I am developing a progress bar in javascript. For that I planned to have series of small DIVs in a big DIV. I have written a below function.It is working in IE, but not in Firefox. - function createDiv(leftPx, topPx, widthPx, heightPx, divColor)
-
{
-
dv = document.createElement('div');
-
dv.style.position="absolute";
-
dv.style.pixelLeft=leftPx;
-
dv.style.pixelTop=topPx;
-
dv.style.pixelWidth=widthPx;
-
dv.style.pixelHeight=heightPx;
-
dv.style.backgroundColor=divColor;
-
dv.innerHTML='|';
-
parentDiv.appendChild(dv); // parentDiv = ID of bigger DIV defined in HTML
-
}
-
I set a for loop to contineously change the leftPos and call the above function.
1. In IE, the progress bar is dislayed correctly. But in Firefox, individual DIVs are overwritten in the first place. The position of parent DIV is "relative".
2. I am not able to see individual DIVs, if dv.innerHTML='|'; line is commented. Is there any way to get the output without that?
I will appriciate if anyone helps me.
Thanks in advance.
Srini
3 1521
1. In IE, the progress bar is dislayed correctly. But in Firefox, individual DIVs are overwritten in the first place. The position of parent DIV is "relative".
The pixelLeft, pixelTop, pixelWidth, and pixelHeight are not valid attributes in the Mozilla or the W3C DOM's
http://developer.mozilla.org/en/docs/DOM:CSS
2. I am not able to see individual DIVs, if dv.innerHTML='|'; line is commented. Is there any way to get the output without that?
Both Firefox and IE will at times not render empty layers or table cells. Insert " " instead of "|". It will keep the layer from being empty, and will be rendered as a blank space.
The pixelLeft, pixelTop, pixelWidth, and pixelHeight are not valid attributes in the Mozilla or the W3C DOM's
http://developer.mozilla.org/en/docs/DOM:CSS
Both Firefox and IE will at times not render empty layers or table cells. Insert " " instead of "|". It will keep the layer from being empty, and will be rendered as a blank space.
Thanks a lot. Now its working. But there is some height variation in displaying the DIVs with text(  or |). IE displays some of the content outside the main div.I am trying to resolve it. The link you have provided is very useful one.
IE displays some of the content outside the main div.I am trying to resolve it.
That is because the position attribute is set to "absolute", and you have a fixed width value set. With the absolute value set the layer will only be as wide as it is defined regardless of the length of the content.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: MattB |
last post by:
Hello please help,
I have a table cell with a div in it. The div has a width of 300px.
but when it is rendered it puts extra space into the table cell.
Here's the style
<style>...
|
by: WindAndWaves |
last post by:
Hi Gurus
I have a page, which looks a bit like this:
....
<body>
<div ID=id1>................</DIV>
<div ID=gsd>................</DIV>
<div ID=ewd>................</DIV>
<div...
|
by: Bob Bedford |
last post by:
Hello,
I've coded a tab pages somes years ago, with a search engine (with the help
of an other programmer) allowing to search in many divs (any tab show/hide a
div).
Now, I've to change code...
|
by: Frances |
last post by:
I need to replace iframes acc. to what option user chooses in a sel
obj.. but figured have to load a blank iframe when pg loads so I can
replace it.. (iframe gets put in a pre-existing div..) this...
|
by: meltedown |
last post by:
I would like the floating divs to float and then the header to come
after them , on the left. That's what I thought clearing the floats was
for, but in this example, the header is to the right of...
|
by: Ankit Aneja |
last post by:
I have a strange situation and I have no idea how to solve this.
Its a Recruitment Search Page,in the Admin Page, for every button click
event the Admin Person has to create a checkbox on the users...
|
by: snesbit |
last post by:
I have a static ContextMenu already built and it works.
I am trying to add a submenu (right arrow with a new menuitem list) dynamically when the popup is created.
The new set of menuitems...
|
by: Tarscher |
last post by:
hi all,
I have this seemingly simple problem. I have lost a lot of time on it
though.
When a user selects a value from a dropdownlist (static control) a
dynamic control is generated. I have...
|
by: pbd22 |
last post by:
Hi.
This is just a disaster management question.
I am using XMLHTTP for the dynamic loading of content in a very
crucial area of my web site. Same as an IFrame, but using XMLHTTP and
a DIV. I...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |