Line spacing error in Mozilla?

S

Steven

Hi,
I have a function which reads all lines from an array and writes them with
the required tags. This works fine with IE, but not with Mozilla.
On http://users.pandora.be/nenya/test/linespacing.htm I write the text both
in a script and as plain HTML.
http://users.pandora.be/nenya/test/linespacing.jpg shows what Mozilla makes
of it. In IE the part "written by script" displays the same as "plain HTML".
Does anyone have an idea what's wrong here? Does Mozilla have a bug where
Internet Exploder doesn't?
 
J

Janwillem Borleffs

Steven said:
Hi,
I have a function which reads all lines from an array and writes them with
the required tags. This works fine with IE, but not with Mozilla.
On http://users.pandora.be/nenya/test/linespacing.htm I write the text both
in a script and as plain HTML.
http://users.pandora.be/nenya/test/linespacing.jpg shows what Mozilla makes
of it. In IE the part "written by script" displays the same as "plain HTML".
Does anyone have an idea what's wrong here? Does Mozilla have a bug where
Internet Exploder doesn't?

It's the way Mozilla renders the lines written by document.write. To
simulate the way IE does it, just prepare a variable and write the text at
once when the loop is finished:

var text = '';
for (var i=0; i<q.length; i++) {
.....
text += '<tr>';
text += '<td class="body"><p>' + a2[0] + '</p>';
text += '<p class="qref">' + a2[1] + '</p></td>';
text += '</tr>';
}
document.write(text);


JW
 
S

Steven

Janwillem Borleffs said:
Steven said:
Hi,
I have a function which reads all lines from an array and writes them with
the required tags. This works fine with IE, but not with Mozilla.
On http://users.pandora.be/nenya/test/linespacing.htm I write the text both
in a script and as plain HTML.
http://users.pandora.be/nenya/test/linespacing.jpg shows what Mozilla makes
of it. In IE the part "written by script" displays the same as "plain HTML".
Does anyone have an idea what's wrong here? Does Mozilla have a bug where
Internet Exploder doesn't?

It's the way Mozilla renders the lines written by document.write. To
simulate the way IE does it, just prepare a variable and write the text at
once when the loop is finished:

var text = '';
for (var i=0; i<q.length; i++) {
.....
text += '<tr>';
text += '<td class="body"><p>' + a2[0] + '</p>';
text += '<p class="qref">' + a2[1] + '</p></td>';
text += '</tr>';
}
document.write(text);


JW

Solved!
Bedankt Janwillem

Steven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top