As expected?

Discussion in 'ASP General' started by Evertjan., May 28, 2004.

  1. Evertjan.

    Evertjan. Guest

    I did not expect this to work as expected:

    <%
    function a()
    %>ha !<br><%
    end function

    a
    a
    a
    a
    a
    %>

    So, why do we use so much response.writes?

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., May 28, 2004
    #1
    1. Advertising

  2. Evertjan.

    Patrice Guest

    Mixing HTML and VBScript code is generally considered as less easier to
    read. For example if you want to use a variable instead of ! you'll have
    something like :

    Sub a(ByVal Mark)
    %><!--ha--><%=Mark%><br><%
    End Sub

    Opposed to :

    Sub a(ByVal Mark)
    Response.Write("ha ")
    Response.Write(Mark)
    Response.Write("<br>")
    End Sub



    Patrice

    "Evertjan." <> a écrit dans le message de
    news:Xns94F7589DDE5AEeejj99@194.109.133.29...
    > I did not expect this to work as expected:
    >
    > <%
    > function a()
    > %>ha !<br><%
    > end function
    >
    > a
    > a
    > a
    > a
    > a
    > %>
    >
    > So, why do we use so much response.writes?
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    Patrice, May 28, 2004
    #2
    1. Advertising

  3. I agree with Patrice, it's easier to read.

    In some projects I have used a shortcut function like this:

    function rw(s)
    response.write s
    end function

    rw "Hello"
    rw "Goodbye"

    I have also used wl, which mimicked writeline (adding carriage returns /
    <br> etc. so I didn't have to think about putting the HTML into the text).

    I think another factor is that many people are in the habit of avoiding
    context switching because IIS *used* to be a bit inefficient with it.

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/


    "Evertjan." <> wrote in message
    news:Xns94F7589DDE5AEeejj99@194.109.133.29...
    >I did not expect this to work as expected:
    >
    > <%
    > function a()
    > %>ha !<br><%
    > end function
    >
    > a
    > a
    > a
    > a
    > a
    > %>
    >
    > So, why do we use so much response.writes?
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)
     
    Aaron Bertrand [MVP], May 28, 2004
    #3
  4. Evertjan. wrote:
    > I did not expect this to work as expected:
    >
    > <%
    > function a()
    > %>ha !<br><%
    > end function
    >
    > a
    > a
    > a
    > a
    > a
    > %>
    >
    > So, why do we use so much response.writes?
    >

    Some Microsoft URLs term the above a "render function", e.g.,:
    "Migrating to ASP.NET: Key Considerations" by Jim Kieley:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnetmigrissues.asp

    According to that Microsoft article and others, "render functions" are
    not allowed in ASP.NET, which is unfortunate. Personally I think they're
    kinda cute and handy, yet another reason to use ASP instead of ASP.NET.
     
    Michael D. Kersey, May 28, 2004
    #4
    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. Phil Tomson
    Replies:
    3
    Views:
    1,462
    Phil Tomson
    Feb 16, 2005
  2. Paul
    Replies:
    0
    Views:
    311
  3. Ammar_ace

    BC30188 Declaration Expected

    Ammar_ace, Jul 30, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    5,047
    Fraggle
    Aug 21, 2003
  4. Kathy Burke
    Replies:
    2
    Views:
    432
    Kathy Burke
    Aug 1, 2003
  5. gh0st54
    Replies:
    6
    Views:
    8,090
    Natty Gur
    Aug 19, 2003
Loading...

Share This Page