Is it inefficient to intermix HTML and script?

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Is it inefficient to intermix HTML and script?

    I've noticed that most examples offered in this group tend to use Response.Write to spit out the HTML rather than switch between
    script and HTML. I also came across an article intimating the same idea. Is this considered inefficient?

    <%If (IsArray(ar)) Then
    Const cNumber = 0
    Const cHorse = 1
    Const cOwner = 2
    Const cTrainer = 3
    Const cRider = 4
    Const cHorseID = 5
    Const cOwnerID = 6
    Const cTrainerID = 7
    Const cRiderID = 8%>
    <tr>
    <th width="8%" align="center"><a class="results" href="showshowentries.asp?Show=<%= strShowID%>&Sort=Number"><font face="Arial, Helvetica, sans-serif" size="2"><b>Number</b></font></a></th>
    <th width="23%" align="left"><a class="results" href="showshowentries.asp?Show=<%= strShowID%>&Sort=Horse"><font face="Arial, Helvetica, sans-serif" size="2"><b>Horse</b></font></a></th>
    <th width="23%" align="left"><a class="results" href="showshowentries.asp?Show=<%= strShowID%>&Sort=Owner"><font face="Arial, Helvetica, sans-serif" size="2"><b>Owner</b></font></a></th>
    <th width="23%" align="left"><a class="results" href="showshowentries.asp?Show=<%= strShowID%>&Sort=Trainer"><font face="Arial, Helvetica, sans-serif" size="2"><b>Trainer</b></font></a></th>
    <th width="23%" align="left"><a class="results" href="showshowentries.asp?Show=<%= strShowID%>&Sort=Rider"><font face="Arial, Helvetica, sans-serif"
    size="2"><b>Rider</b></font></a></th></tr>
    <% Dim iRow
    For iRow = 0 To UBound(ar,2)%>
    <tr>
    <td width="8%" align="center" valign="top"><font face="Arial, Helvetica, sans-serif" size="2"><%= ar(cNumber,iRow)%></font></td>
    <td width="23%" align="left" valign="top"><a class="results" href="showexhibitorresults.asp?Show=<%= strShowID%>&HorseID=<%= ar(cHorseID,iRow)%>"><font face="Arial, Helvetica, sans-serif"
    size="2"><%= ar(cHorse,iRow)%></font></a></td>
    <td width="23%" align="left" valign="top"><a class="results" href="showexhibitorresults.asp?Show=<%= strShowID%>&OwnerID=<%= ar(cOwnerID,iRow)%>"><font face="Arial, Helvetica, sans-serif"
    size="2"><%= ar(cOwner,iRow)%></font></a></td>
    <td width="23%" align="left" valign="top"><a class="results" href="showexhibitorresults.asp?Show=<%= strShowID%>&TrainerID=<%= ar(cTrainerID,iRow)%>"><font face="Arial, Helvetica,
    sans-serif" size="2"><%= ar(cTrainer,iRow)%></font></a></td>
    <td width="23%" align="left" valign="top"><a class="results" href="showexhibitorresults.asp?Show=<%= strShowID%>&RiderID=<%= ar(cRiderID,iRow)%>"><font face="Arial, Helvetica, sans-serif"
    size="2"><%= ar(cRider,iRow)%></font></a></td></tr>
    <% Next%>
    <tr>
    <td align="right" colspan="5"><font face="Arial, Helvetica, sans-serif" size="2"><b><%= intTotalEntries%> total show entries&nbsp;&nbsp;&nbsp;&nbsp;</b></font></td></tr>
    <%Else%>
    <tr>
    <td colspan="5" align="center"><font face="Arial, Helvetica, sans-serif" size="2"><b>There are no items to show in this view.</b></font></td></tr>
    <%End If%>
    </table>
    </td>
    </tr>
    <!--#include file="inc/table_end.asp" -->

    Stefan Berglund Guest

  2. Similar Questions and Discussions

    1. #37168 [Fbk->Opn]: WDDX serializer inefficient with larger structures
      ID: 37168 User updated by: dolecek at sky dot cz Reported By: dolecek at sky dot cz -Status: Feedback +Status: ...
    2. #37168 [Opn->Fbk]: WDDX serializer inefficient with larger structures
      ID: 37168 Updated by: iliaa@php.net Reported By: dolecek at sky dot cz -Status: Open +Status: ...
    3. Using a script to have CF convert cfm to html
      I have a page that takes the coldfusion server a long time to process and its contents are the same for everyone. I want to write a script that will...
    4. Array slicing through a reference: Inefficient?
      Dear Group-- I'm working on a project where I'm working with large arrays, and I'm using references to pass arrays around to reduce memory use as...
    5. Is this inefficient?
      I may have two buttons on the form and the Form Action has the same value as the current form, then at the top of my php script, I may have ...
  3. #2

    Default Re: Is it inefficient to intermix HTML and script?

    > I've noticed that most examples offered in this group tend to use
    Response.Write to spit out the HTML rather than switch between
    > script and HTML. I also came across an article intimating the same idea.
    Is this considered inefficient?

    No, just much more difficult to read / maintain, IMHO. I prefer
    response.write, but there really is no difference in performance due to
    context switches between ASP and HTML (though at one point the ASP parser
    wasn't as smart as it is now, and you would notice a hit given enough
    volume).


    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: Is it inefficient to intermix HTML and script?

    If you're running IIS 5 or higher, don't worry about it. Do whichever you
    are more comfortable with. If you're on IIS 4 (NT), yeah, it's inefficient,
    but hopefully you won't be on an NT server for much longer, so I wouldn't
    worry about it. Just code comfortably. :]

    Ray at work

    "Stefan Berglund" <keepit@in.thegroups> wrote in message
    news:v9g8pv0q18k9n199dobahhcga06f04rpt1@4ax.com...
    > I've noticed that most examples offered in this group tend to use
    Response.Write to spit out the HTML rather than switch between
    > script and HTML. I also came across an article intimating the same idea.
    Is this considered inefficient?


    Ray at Guest

  5. #4

    Default Re: Is it inefficient to intermix HTML and script?

    On Mon, 20 Oct 2003 13:17:02 -0700, Stefan Berglund
    <keepit@in.thegroups> wrote:
    >I've noticed that most examples offered in this group tend to use Response.Write to spit out the HTML rather than switch between
    >script and HTML. I also came across an article intimating the same idea. Is this considered inefficient?
    For me it's force of habit and the method of coding. I tend to write
    ASP in commented pseudocode to get the process down, then fill in the
    bits and pieces testing as I go. Since I tend to do a lot of
    Response.Write statements to show the output and values as I code,
    when I get to the HTML I tend to leave the Response.Write alone and
    fit in the HTML code into the Response.Write statements.

    On the other hand, when I'm editing/maintaining someone else's code
    that has the HTML separated and does things like:

    <P>Glad to see you here on <% =(Now) %></P>

    Then I tend to work in the same manner the original code is written.

    Note that I am by far a sloppy coder, generally poorly organized and
    bad at useful documentation, plus I tend to leave irrelevant code in
    at times, but hey, it works. :)

    Jeff
    Jeff Cochran Guest

  6. #5

    Default Re: Is it inefficient to intermix HTML and script?

    On Mon, 20 Oct 2003 13:17:02 -0700, Stefan Berglund
    <keepit@in.thegroups> wrote:
    in <v9g8pv0q18k9n199dobahhcga06f04rpt1@4ax.com>
    >I've noticed that most examples offered in this group tend to use Response.Write to spit out the HTML rather than switch between
    >script and HTML. I also came across an article intimating the same idea. Is this considered inefficient?
    Thank you gentlemen one and all for your valued consideration and
    comments.
    Stefan Berglund Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139