Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Line breaks in HTML code

Reply
Thread Tools

Line breaks in HTML code

 
 
mailbox
Guest
Posts: n/a
 
      05-26-2005
Did write it down once, but have forgotten !!

How is it you should format your ASP code to that when viewing the resulting
HTML text from the browsers "view code" it looks nice with line breaks?


 
Reply With Quote
 
 
 
 
Adrienne
Guest
Posts: n/a
 
      05-26-2005
Gazing into my crystal ball I observed "mailbox" <(E-Mail Removed)>
writing in news:(E-Mail Removed):

> Did write it down once, but have forgotten !!
>
> How is it you should format your ASP code to that when viewing the
> resulting HTML text from the browsers "view code" it looks nice with
> line breaks?
>
>
>


You can escape from ASP eg:
<% 'your asp code here%>
<p>This is the result of <%=variable%></p>
<% 'more code%>
<p>This is another result of <%=anothervariable%></p>

Or:
<% text = "some text" & vbcrlf
text = text & "more text"
response.write replace(text,vbcrlf,"<br>")
%>

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
 
Reply With Quote
 
 
 
 
please-answer-here
Guest
Posts: n/a
 
      05-26-2005
Adrienne wrote:
> Gazing into my crystal ball I observed "mailbox"
> <(E-Mail Removed)> writing in
> news:(E-Mail Removed):
>
>> Did write it down once, but have forgotten !!
>>
>> How is it you should format your ASP code to that when viewing the
>> resulting HTML text from the browsers "view code" it looks nice with
>> line breaks?
>>
>>
>>

>
> You can escape from ASP eg:
> <% 'your asp code here%>
> <p>This is the result of <%=variable%></p>
> <% 'more code%>
> <p>This is another result of <%=anothervariable%></p>


It's not the resulting HTML page I'm having problem with. What I would like
to implement is that when you after loading the asp page, would like to view
the HTML source code that code would be layouted with line breaks

>
> Or:
> <% text = "some text" & vbcrlf
> text = text & "more text"
> response.write replace(text,vbcrlf,"<br>")
> %>



 
Reply With Quote
 
Roland Hall
Guest
Posts: n/a
 
      05-26-2005
"please-answer-here" wrote in message
news:uV$(E-Mail Removed)...
: Adrienne wrote:
: > Gazing into my crystal ball I observed "mailbox"
: > <(E-Mail Removed)> writing in
: > news:(E-Mail Removed):
: >
: >> Did write it down once, but have forgotten !!
: >>
: >> How is it you should format your ASP code to that when viewing the
: >> resulting HTML text from the browsers "view code" it looks nice with
: >> line breaks?
: >>
: >>
: >>
: >
: > You can escape from ASP eg:
: > <% 'your asp code here%>
: > <p>This is the result of <%=variable%></p>
: > <% 'more code%>
: > <p>This is another result of <%=anothervariable%></p>
:
: It's not the resulting HTML page I'm having problem with. What I would
like
: to implement is that when you after loading the asp page, would like to
view
: the HTML source code that code would be layouted with line breaks

It's vbCrLf. You will only see the line breaks in the source, not displayed
in the browser. That requires <br />.

I use:

sub prt(str)
Response.Write str & vbCrLf
end sub

I use it for generally anything with a tag...
prt "<html>"
prt "<head>"
prt "</head>"

You can use them together as Adrienne showed...

sub lprt(str)
Response.Write str & "<br />" & vbCrLf
end sub

I use it for anything without a tag where I was a line break displayed in
the browser...

lprt "Error: The field cannot be left blank."

You can even use it for a blank line...

lprt ""

sub wprt(str)
Response.Write str
end sub

I use it for when I want to print but not end the line...

prt "<table>"
wprt "<tr><td>" & someVariable & "</td>"
' do some processing...
wprt "<td>" & addAnotherVariable & "</td>"
' do some more processing
prt "<td>" & andAnother & "</td></tr>"
prt "</table>"

sub debug(str)
Response.Write "<span style=""background-color: #efe"">" & str & "<br
/>" & vbCrLf
end sub

This one should be obvious...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


 
Reply With Quote
 
Hal Rosser
Guest
Posts: n/a
 
      05-26-2005

"mailbox" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Did write it down once, but have forgotten !!
>
> How is it you should format your ASP code to that when viewing the

resulting
> HTML text from the browsers "view code" it looks nice with line breaks?
>


If you just want your 'view source' to look good
use VBCrLf to include the newline characters


 
Reply With Quote
 
please-answer-here
Guest
Posts: n/a
 
      05-26-2005
Hal Rosser wrote:
> "mailbox" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Did write it down once, but have forgotten !!
>>
>> How is it you should format your ASP code to that when viewing the
>> resulting HTML text from the browsers "view code" it looks nice with
>> line breaks?
>>

>
> If you just want your 'view source' to look good
> use VBCrLf to include the newline characters


Thanks to everyone for refreshing my memory


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginner: read $array with line breaks line by line Marek Stepanek Perl Misc 12 09-02-2006 10:27 AM
Force multi line field value to output with line breaks? bernadou ASP .Net Web Controls 2 01-23-2006 01:23 PM
Maintaining line breaks in HTML email Andrew Banks ASP .Net 2 04-04-2004 04:48 PM
need to find out why the code breaks at line #285 please Help Sam ASP .Net Web Services 1 01-31-2004 07:44 PM
html-->text, keep line breaks, best strategy is? Henry Perl Misc 2 12-18-2003 04:53 PM



Advertisments