473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

.innerHTML bug with mozilla/firefox (Ajax)

Hi!

I am currently developping a user interface with Ajax/C#/.net. And I am
facing a problem with Mozilla, and Firefox.

I use the function innerHTML to load a Web UserControl into a div, this
way the main page never gets refreshed. It works perfectly under IE,
but with Mozilla and Firefox I got a problem : there is a space before
the thing I want to display everytime I use ".innerHTML".

For example:

I have a div called "test" like ...
=> "something"
When I use test.innerHTML = "something else", I get ...
=> "
something else"
Could someone help me, please?

Apr 10 '06 #1
8 7738
Clément wrote:
I have a div called "test" like ...
=> "something"
When I use test.innerHTML = "something else", I get ...
=> "
something else"
[...]


Why, `div' elements are block-level elements by default. So they may have
a (top) margin, and the parent block-level element may have a (top) padding.
If you do not want the padding or the margin (as defined in the basic
stylesheet), you have to set it to 0, using CSS.

That there is a padding or a margin is no bug at all.
PointedEars
Apr 10 '06 #2
All the margin and padding values are set to 0px.
And actually, everytime I execute the function, the display change!
so it is like ...

original page
=> "something"
test.innerHTML = "something else"
=> "
something else"
test.innerHTML = "something else"
=> "

something else"
test.innerHTML = "something else"
=> "
something else"
I cheked the code in the innerHTML, with the function alert.
And there is another problem.
In fact, when I do :
test.innerHTML =
'<div><table><tr><td>something</td></tr></table></div>'
The result is weird, because I check the code with an alert and I get
....
alert(test.innerHTML);
=>'<div></div><table><tr><td>something</td></tr></table>'

Why does Mozilla do that?? Apparently, Netscape does the same.

Apr 11 '06 #3
Clément wrote:
All the margin and padding values are set to 0px.
And actually, everytime I execute the function, the display change!
so it is like ...

original page
=> "something"
test.innerHTML = "something else"
=> "
something else"
test.innerHTML = "something else"
=> "

something else"
test.innerHTML = "something else"
=> "
something else"
Weird. But .innerHTML is proprietary, so one should not expect consistent
results.
I cheked the code in the innerHTML, with the function alert.
And there is another problem.
In fact, when I do :
test.innerHTML =
'<div><table><tr><td>something</td></tr></table></div>'
The result is weird, because I check the code with an alert and I get
...
alert(test.innerHTML);
=>'<div></div><table><tr><td>something</td></tr></table>'

Why does Mozilla do that?? Apparently, Netscape does the same.


The are dozens of versions of Mozilla (Seamonkey) and Netscape (Navigator).
None of my innerHTML-capable Mozilla browsers[1] does show such a behavior.
Which ones have you tested with (Help, About)?

The code you posted is insufficient for problem analysis. Please post the
public URL of a test case. (Maybe in creating that test case, you will
find the problem yourself.)

Please quote what you are replying to, as customary on Usenet.[2][3]
PointedEars
___________
[1] Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060205
Debian/1.7.12-1.1

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040805
Netscape/7.2

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4.1) Gecko/20020508
Netscape6/6.2.3

[2] <URL:http://www.safalra.com/special/googlegroupsreply/>

[3] <URL:http://jibbering.com/faq/faq_notes/pots1.html>
news:12****************@PointedEars.de
Apr 11 '06 #4
Thomas 'PointedEars' Lahn wrote:
Clément wrote:
[...]
In fact, when I do :
test.innerHTML =
'<div><table><tr><td>something</td></tr></table></div>'
The result is weird, because I check the code with an alert and I get
...
alert(test.innerHTML);
=>'<div></div><table><tr><td>something</td></tr></table>'

Why does Mozilla do that?? Apparently, Netscape does the same.


[...]
None of my innerHTML-capable Mozilla browsers[1] does show such a
behavior. [...]
___________
[1] Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060205
Debian/1.7.12-1.1

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040805
Netscape/7.2

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4.1) Gecko/20020508
Netscape6/6.2.3


I forgot

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060313
Debian/1.5.dfsg+1.5.0.1-4 Firefox/1.5.0.1
PointedEars
Apr 11 '06 #5
> The are dozens of versions of Mozilla (Seamonkey) and Netscape (Navigator).
None of my innerHTML-capable Mozilla browsers[1] does show such a behavior.
Which ones have you tested with (Help, About)?
This is the version of Mozilla/Firefox I am using ...
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.1)
Gecko/20060111 Firefox/1.5.0.1

The code you posted is insufficient for problem analysis. Please post the
public URL of a test case. (Maybe in creating that test case, you will
find the problem yourself.)


I can't create a test case on a public URL because I am developping
this application with C# / .net, and servers for it are not free!
Moreover, I don't have the right to do it vis-a-vis of my company.

But to explain you a little more, I have a main page in which I have 3
div. I load web user controls dynamically (with ajax) in one of them.
The code generated by the WUC, which contains another div that contains
other things (this way <div><table> ... </table></div>), is put in the
div with the function .innerHTML. And as I told you, with IE it works
perfectly, but with Mozilla/Firefox and Netscape the code into the
div.innerHTML is changed like "<div></div><table>...</table>".

Apr 11 '06 #6
I found a solution!
It is really weird...

In fact I was using an asp:panel in my aspx page, that was replaced in
the navigator by a DIV, which is normal, but that DIV had this strange
behavior I explained.
I really don't know why! But by replacing this asp:panel by a standard
DIV, the problems disappear!!!

Thanks anyway for your help!

Apr 11 '06 #7
Thomas 'PointedEars' Lahn wrote:

Weird. But .innerHTML is proprietary, so one should not expect consistent
results.


I've had quite consistent results with innerHTML most of the time. The
only time I've had problems is when I've tried using innerHTML to add
rows to a table (there are better ways to do that) and to add items to a
SELECT (there are better ways to do that, too). Otherwise, it's been
quite consistent.

Are there instances of inconsistencies other than those I mentioned that
you can point me to? And what browsers? That info could prove useful...
Apr 11 '06 #8
spsoni
1
Hi there,

Recently I am also facing similar problem of extra space above DIV, in my html when I am fetching dynamic information using ajax.

I am calling my php code using AJAX, and when assigning returned result as follows:

element.innerHTML = xmlhttp.responseText;

is creating some extra space in my main page.

and the beauty of this problem is that, it is working fine with Firefox and all, but not with IE 6.

I believe, there is some extra special characters coming from my php code, but I cannot trace returned text, since view source do not work for AJAX received data.

Please help.

Same problem with me, I cannot share the code or link, its all paid stuff.

Thanking you advance for your help.

Regards,

Surya


I found a solution!
It is really weird...

In fact I was using an asp:panel in my aspx page, that was replaced in
the navigator by a DIV, which is normal, but that DIV had this strange
behavior I explained.
I really don't know why! But by replacing this asp:panel by a standard
DIV, the problems disappear!!!

Thanks anyway for your help!
May 4 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ekimnosnews | last post by:
I'm programming a JS tile map editor for my friend's game. The map editor has different "sections" that contain different tiles. The way that it works is when you select a section it calls a JS...
1
by: Sergey Ilinsky | last post by:
Well, while working on a rich ui with DHTML I discovered the following problem: Mozilla/Firefox seems to be wrong when rendered elements with sizes given in percents and that are placed into...
2
by: Eli | last post by:
Hi, Since using IFRAMEs in my page, I want to disable the F5 and BackSpace keys. I got this working on IE but not on Mozilla Firefox: function CheckKey(evt) { evt=(evt)?evt:window.event;...
0
by: BACON | last post by:
I'm just starting the process of reorganising my modest little website and cleaning up all the HTML, and the logical place to begin was with the homepage. I made a simple little ASP.NET control...
5
by: Prasad | last post by:
Hi all, I wanted to know whether my page is connecting to server or not using xmlHttp request. For that , I am using one condition in onreadystatechange function as.. function xxx() {...
2
by: sajithamol | last post by:
How can i migrate one application from IE to Mozilla Firefox. while working in IE , javascript was working perfectly . But when i used Mozilla firefox , javascript not working. How can i make one...
3
by: carolinevdp | last post by:
Hi all, I wrote a program that grabs the url of the IE windows that are opened by iterating with FindWindowEx until I find the window with FindWindowEx(ComboBoxChild, 0, "toolbarwindow32",...
9
by: mukeshrasm | last post by:
hi I am passing the value of select to a function which is called on click event of button. here is the code <select name="ctName" style="width:300px;" id="clientname" > ...
0
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
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.