473,320 Members | 1,879 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,320 software developers and data experts.

  does not render properly with document.createTextNode

69
Hi,

I'm having trouble creating a blank table row in Javascript using document.createElement( ' ' ). When I look at the generated source it has intrepreted it as
Expand|Select|Wrap|Line Numbers
  1. <td>&amp;nbsp;</td>
. What do I need to do? I've tried using single quotes, double quotes and backslash.

Thanks,

Sean
Oct 23 '07 #1
7 9641
acoder
16,027 Expert Mod 8TB
&nbsp; is not an element.

Do you want something like:
[HTML]<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>[/HTML]
Oct 23 '07 #2
Sebarry
69
Yes that's exactly what I want.

&nbsp; is not an element.

Do you want something like:
[HTML]<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>[/HTML]
Oct 23 '07 #3
gits
5,390 Expert Mod 4TB
hi ...

try to use

Expand|Select|Wrap|Line Numbers
  1. document.createTextNode('&nbsp;');
instead of createElement ...

kind regards
Oct 23 '07 #4
Sebarry
69
Hi,

I was being a complete hipster doffus with the post because that's what I was doing anyway. What I've got is:

Expand|Select|Wrap|Line Numbers
  1. row = document.createElement( "tr" );
  2. column = document.createElement( "td" );
  3. var columnText = document.createTextNode('&nbsp;');
  4. column.appendChild( columnText );
  5. row.appendChild( column );
  6.  
  7. var theTable = document.getElementById('articleContents');
  8. theTable.tBodies[0].appendChild(row);
  9.  
Cheers,

Sean

hi ...

try to use

Expand|Select|Wrap|Line Numbers
  1. document.createTextNode('&nbsp;');
instead of createElement ...

kind regards
Oct 24 '07 #5
acoder
16,027 Expert Mod 8TB
Hi,

I was being a complete hipster doffus with the post because that's what I was doing anyway.
So you had it working all along? Is there only one column in your table?
Oct 24 '07 #6
Sebarry
69
No it still doesn't work. When I supply
Expand|Select|Wrap|Line Numbers
  1. '&nbsp'
to createTextNode in the generated source it's shown as
Expand|Select|Wrap|Line Numbers
  1. <td>&amp;nbsp;</td>
So you had it working all along? Is there only one column in your table?
Oct 24 '07 #7
acoder
16,027 Expert Mod 8TB
Ah right, I see what you mean now. I've changed the thread title accordingly.

Try using unicode, e.g. "\u00a0".
Oct 24 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Tjerk Wolterink | last post by:
In XHTML the entity nbsp stands for   A normal space like " " is also displayed as an normal space, but multiple spaces like " " are interpreted as 1 space in the xhtml page. So there comes...
13
by: rbronson1976 | last post by:
Hi all, I have a very simple page that Firefox has problems with: www.absolutejava.com/testing.htm First of all, this page seems to be perfectly valid XHTML Strict. Both the W3C validator as...
2
by: Bill Green | last post by:
I am trying to add an indent to a Dropdown control. I prefix the text for the ListItem with a couple &nbsp; but it doesn't render the tags to spaces , instead the dropdown list shows: MainItem...
2
by: mortb | last post by:
A validator that is not displayed will render a &nbsp; tag in the output page. This cuases me problems as I don't wnat anything to show in this case. Is there any way to get rid of the &nbsp; ? ...
9
by: Jouni Karppinen | last post by:
I create a HTMLTable in my C# code and then add rows and cells into that table. I'm trying to set top and bottom border for each cell by using stylesheet and it works as far as cell has some text...
14
by: madtom1999 | last post by:
I'm trying to put a non-breaking space ( or any other entity for that matter) into a node eg: node.nodeValue+='&nbsp'; however the actual code is written in the html -ie it displays as >&nbsp;<...
1
by: PJ | last post by:
Is it possible to prevent the drop down list from html encoding the text in ListItems? I would like to put some spaces to add padding to certain items with spaces, but when it it rendered asp.net...
3
by: yawnmoth | last post by:
<? echo 'a'.trim(html_entity_decode('&nbsp;a&nbsp;')).'a'; ?> Shouldn't PHP output aaa? Looking at the documentation for trim I see that it doesn't support chr(0xA0) (eg....
28
by: entfred | last post by:
I have the following line of html: &nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nbsp;&nbsp;&nbspyow In Internet Explorer 6.0, the columns look ok using the above html: 1234 abcd ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.