Line Wrapping

S

scott

Is there a way to prevent IE from forcing a line break? Below in LISTING 2,
you notice the table background image extention of '.jpg' begins a new line,
instead of staying on the same line as it's file name. Same happens with my
javascript onclick event, IE forces a line break and breaks my code. In my
asp code, you notice I'm inserting line breaks, but IE seems to do what it
wants. I should note, the below HTML results is actually 1 table of 40 or so
that asp builds as a string.

I mention that because some tables get rendered without line breaks
following the 'jpg' and javascript code. My prolem is that when IE forces
line breaks as below, the code doesn' work.

Any ideas?

LISTING 1 - CODE

ColorInfo = ColorInfo & "<table border=0
background=""images/prints/thumb_" & RS10("choiceData1") & ".jpg""
style='border:solid 1pt #000000' cellpadding=0 cellspacing=0>" & chr(13) &
chr(10)
ColorInfo = ColorInfo & "<tr><td>" & chr(13) & chr(10)
ColorInfo = ColorInfo & "<a href=""""
onclick=""javascript:pW('pop_print.asp?print=" & RS10("choiceData1") &
"',310,400);return false;"">" & chr(13) & chr(10)
ColorInfo = ColorInfo & "<img src=""images/filler.gif"" width=60
height=40 border=0></a>" & chr(13) & chr(10)
ColorInfo = ColorInfo & "</td></tr></table></tr>" & chr(13) & chr(10)
ColorInfo = ColorInfo & "<tr><td align=center><font
face=""verdana,sans-serif"" size=1>" & Replace(RS10("choiceName"),"
","<br>",1,1) & "</font></td></tr></table></td>" & chr(13) & chr(10)


LISTING 2 - RESULTS

<table border=0 background="images/prints/thumb_Abbey
..jpg" style='border:solid 1pt #000000' cellpadding=0 cellspacing=0>
<tr><td>
<a href="" onclick="javascript:pW('pop_print.asp?print=Abbey
',310,400);return false;">
<img src="images/filler.gif" width=60 height=40 border=0></a>
</td></tr></table>
 
S

scott

I tried it, but as you see below, it had no effect. is there any way to
structure my below html so the NOWRAP will work for my problem? i see how it
works with regular text, but my case is a little different.

<table border=0><tr><td NOWRAP align=center>
<table border=0 background="images/prints/thumb_Abbey
..jpg" style='border:solid 1pt #000000' cellpadding=0 cellspacing=0>
<tr><td NOWRAP><a href="" onclick="javascript:pW('pop_print.asp?print=Abbey
',310,400);return false;">
<img src="images/filler.gif" width=60 height=40 border=0></a>
</td></tr></table></tr>
<tr><td align=center><font face="verdana,sans-serif" size=1>Abbey<br>(AYSP)
</font></td></tr></table>
 
D

Dave Anderson

scott said:
Is there a way to prevent IE from forcing a line break? Below in
LISTING 2, you notice the table background image extention of '.jpg'
begins a new line, instead of staying on the same line as it's file
name...

background=""images/prints/thumb_" & RS10("choiceData1") & ".jpg""

<table border=0 background="images/prints/thumb_Abbey
.jpg" style='border:solid 1pt #000000' cellpadding=0 cellspacing=0>

Are you certain the source does not contain the line break? Does this work
any better?

..." & Trim(RS10.Fields("choiceData1").Value) & ".jpg""



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
S

scott

no go, i tried your code. It must be the way IIS renders it. at first, i
thought it was long field values, but it does it on 5 character values or
long ones.

i know there must be a solution, but i've exhausted all means.
 
M

Mark Schupp

IIRC Trim will not remove linefeeds.

Try writing out Server.URLEncode(RS10.Fields("choiceData1").Value) to see if
there is something else in the data.

I use similar code to build image urls all the time with no problems.
 
S

scott

your server encode idea produced some interesting results. it still doesn't
work, but it maintained the filename. problem is it added %0D%OA as you can
see below. It only had that effect on certain records and there was no
pattern or sequence on which ones didn't work. it effected the same records
as before.

what coud be causing those characters?

<table border=0><tr><td NOWRAP align=center>
<table border=0 background="images/prints/thumb_Abbey%0D%0A.jpg"
style='border:solid 1pt #000000;margin: 0px;' cellpadding=0 cellspacing=0>
<tr><td NOWRAP><NOBR><a href=""
onclick="javascript:pW('pop_print.asp?print=Abbey
',310,400);return false;"></NOBR>
<img src="images/filler.gif" width=60 height=40 border=0></a>
</td></tr></table></tr>
<tr><td align=center><font face="verdana,sans-serif" size=1>Abbey<br>(AYSP)
</font></td></tr></table>
 
M

Mark Schupp

%0D%0A = CRLF
That is causing your line wrap. You will need to strip it out before
building the URL. See Giles' suggestion.
You should also have a look into your input application to see why it is
including the CRLF at the end of file names.
 
D

Dave Anderson

Mark said:
IIRC Trim will not remove linefeeds.

Yet another reason I like the flexibility of writing my own:

String.prototype.trim = function(){
return this.replace(/(\s*$)|(^\s*)/g,"")
}


Or the more abstracted:

String.prototype.ltrim = function(){
return this.replace(/^\s*/g,"")
}
String.prototype.rtrim = function(){
return this.replace(/\s*$/g,"")
}
String.prototype.trim = function(){
return this.ltrim().rtrim()
}

I am obviously JScript-biased.


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
S

scott

I tried all solution, but none would strip out the extra space. However, big
thanks to all for identifying the problem. When I get physical access to the
db, I will manually clean the offending records. This probably happened
while someone was copy/pasting. It shall not happen again.

Thanks to all of you for saving my sanity.
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top