473,372 Members | 1,296 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,372 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 7733
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" > ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.