Line breaks in HTML code

Discussion in 'ASP General' started by mailbox, May 26, 2005.

  1. mailbox

    mailbox Guest

    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?
     
    mailbox, May 26, 2005
    #1
    1. Advertising

  2. mailbox

    Adrienne Guest

    Gazing into my crystal ball I observed "mailbox" <>
    writing in news::

    > 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
     
    Adrienne, May 26, 2005
    #2
    1. Advertising

  3. Adrienne wrote:
    > Gazing into my crystal ball I observed "mailbox"
    > <> writing in
    > news::
    >
    >> 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>")
    > %>
     
    please-answer-here, May 26, 2005
    #3
  4. mailbox

    Roland Hall Guest

    "please-answer-here" wrote in message
    news:uV$...
    : Adrienne wrote:
    : > Gazing into my crystal ball I observed "mailbox"
    : > <> writing in
    : > news::
    : >
    : >> 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
     
    Roland Hall, May 26, 2005
    #4
  5. mailbox

    Hal Rosser Guest

    "mailbox" <> wrote in message
    news:...
    > 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
     
    Hal Rosser, May 26, 2005
    #5
  6. Hal Rosser wrote:
    > "mailbox" <> wrote in message
    > news:...
    >> 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
     
    please-answer-here, May 26, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Banks

    Maintaining line breaks in HTML email

    Andrew Banks, Apr 4, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    920
    Andrew Banks
    Apr 4, 2004
  2. bernadou

    Force multi line field value to output with line breaks?

    bernadou, Jan 22, 2006, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    391
    bernadou
    Jan 23, 2006
  3. Sam
    Replies:
    1
    Views:
    299
    Egbert Nierop \(MVP for IIS\)
    Jan 31, 2004
  4. Henry
    Replies:
    2
    Views:
    308
    David K. Wall
    Dec 18, 2003
  5. Marek Stepanek
    Replies:
    12
    Views:
    438
    Peter J. Holzer
    Sep 2, 2006
Loading...

Share This Page