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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Wrap - giving me a headache

Status
Not open for further replies.

cfdeveloper

Programmer
Nov 20, 2003
144
GB
Hi Guys,

I'm trying to word wrap some text. I don't know if there is a client side tag that does this for you.

I'm just displaying comments/text on the browser window. I have a table.

<table>
<tr>
<td colspan="6">
Comments
</td>
</tr>
<tr>
<td colspan="6">
#COMMENTS#
</td>
</tr>
</table>

The information is displayed on a pop-up modal dialog box. This is how I call it.

var mouseX = clicked.screenX;
var mouseY = clicked.screenY ;
var numheight = screen.height;
var numwidth = screen.width;
var sHeight = numheight + 'px';
var sWidth = numwidth + 'px';
if (mouseX > numwidth) {var sXPos = (mouseX - numwidth)+'px';}
else {var sXPos = mouseX; }
if (mouseY > numheight) {var sYPos = mouseY +'px';}
else {var sYPos = mouseY; }

var features = "resizable: yes; help: no; status: no; scroll: yes; dialogHeight:" + sHeight +"; dialogWidth:" + sWidth + "; dialogLeft:" + sXPos + "; dialogTop:"+ sYPos + "; "

showModalDialog('printthis.cfm?jobNo=1' , features);

I'm permitting page scrolling; if I view a job with really lengthy comments, since the width and height of the pop-up window is the size of the monitor, with the windows taskbar set to "dispaly on top of other windows", I can't see the the horizontal scroller.

If word-wrapping is a big ask, can you suggest me how to display the horizontal bar just above the windows task bar?

I hope I'm making sense. Can someone please point me to the right direction


Regards,
cfcoder

 
this is how i did it

Code:
<script language = "javascript">
function resize(){
window.moveTo(0,0);
window.resizeTo(screen.width,screen.height-25);
 }
</script>
<body onload = "resize();">

This is a javascript question. better to have been asked here:
forum216



Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
what do you have in your comments that prevents word wrapping to work naturally in the browser? I had a problem once with an enormous hyperlink. There were no breaking characters or spaces in the link so it made the cell huge. other than that you should word wrap automatically.

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 
I added your code but it doesn't resize it at all. The comments have spaces between words, so I don't understand why its doing this. Is it because I'm displaying the contents inside a modal dialog box?

 
I wouldn't assume it isn't wrapping because of that. here is an example that has text that wraps:


is the above table exactly what you have in the code? Sure you don't have a runaway "nowrap" in a td?

try this to resize it.
var numheight = screen.height-25;


Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
-Douglas Adams (1952-2001)
 

If you are using 6.1, you can get CF to do it for you, using the rather unpublicized function called wrap.

wrap(string, Num chars on a line)

i haven't used it yet, but i am assuming that it will cut words up, based on the number you supply in the number of characters parameter.

Hope this helps!

Tony
 
sorry for not getting back sooner. screen.height-25 works, but it pushes the dialog box further down, I want it to appear above the task bar. I don't know what to do about this. I've checked, there is no "nowrap" tagin the code

Thanks
cfcoder
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top