Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically set nowrap !!! ???

Status
Not open for further replies.

simonchristieis

Programmer
Jan 10, 2002
1,144
GB
I am creating a new table and need to set the new cells to be nowrap - but it dont work - any ideas ?

code:

cell.setAttribute("style","white-space: nowrap;")

Thanks in advance

Simon
 
Tried that Jeff - still doesn't work

I am creating the cell dynamically

the code is (snipped)

var row = table.insertRow(table.rows.length);
var cell=row.insertCell(row.cells.length);

cell.setAttribute("width",10)
cell.innerHTML = "whatsoever"

etc

But I cant get the the table to apply nowrap
 
works fine for me in IE6 & Firebird 0.7, WinXP Pro:
Code:
<html>
	<head>
		<title>test</title>
		<script type=&quot;text/javascript&quot;>
			function addRowCell(t) {
				var r = t.insertRow(t.rows.length);
				var c = r.insertCell(r.cells.length);
				c.innerHTML = getCellText(t.rows.length);
				c.style.whiteSpace = &quot;nowrap&quot;;
			}
			function getCellText(n) {
				var s = &quot;&quot;;
				for (var x = 0; x < n; x++) {
					s += &quot;foo bar &quot;;
				}
				return s;
			}
		</script>
	</head>

	<body>
		<form>
			<input type=&quot;button&quot; value=&quot;add row/cell&quot; 
				onclick=&quot;addRowCell(document.getElementById('tbl'));&quot; />
		</form>
		<table id=&quot;tbl&quot; border=&quot;1&quot; width=&quot;100&quot;>
			<tr>
				<th>head</th>
			</tr>
		</table>
	</body>
</html>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Thanks again.

I have the source code of the table created and even that says its working - but it aint !!

<TR>
<TD style=&quot;whitespace: nowrap&quot; width=10 colSpan=6 orgCol=&quot;000000&quot; overCol=&quot;FFCC00&quot; clAction=&quot;createMenu,menu,2&quot;>Division 1</TD></TR>
<TR>

I don't understand why - I have not set any width properties - notice the colspan=6 - the page indents a menu system with td elements - the problem is that the menu elementsare wrapping as the page is created.

Any ideas at all ?

Im using xp / ie6.

 
try setting &quot;white-space&quot; to &quot;nowrap!important&quot;



=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Not tested, but maybe one of these will work for you:

cell.noWrap=true

or

cell.setAttribute(&quot;noWrap&quot;,true)

Adam
while(ignorance==true){perpetuate(violence,fear,hatred);life--};
 

I've tried

c.style.whiteSpace = &quot;nowrap&quot;;
cell.noWrap=true
cell.setAttribute(&quot;noWrap&quot;,true)

even tried

cell.noWrap?true:&quot;Or Else!&quot;;

but none are working - I'm going bald pulling my hair out !!!
 
you said this is the generated source code?
<TR>
<TD style=&quot;whitespace: nowrap&quot; width=10 colSpan=6 orgCol=&quot;000000&quot; overCol=&quot;FFCC00&quot; clAction=&quot;createMenu,menu,2&quot;>Division 1</TD></TR>
<TR>

if so, &quot;whitespace&quot; should be &quot;white-space&quot;



=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top