By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,444 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Is it inefficient to intermix HTML and script?

P: n/a
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" -->

Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
> 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).
Jul 19 '05 #2

P: n/a
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" <ke****@in.thegroups> wrote in message
news:v9********************************@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?
Jul 19 '05 #3

P: n/a
On Mon, 20 Oct 2003 13:17:02 -0700, Stefan Berglund
<ke****@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
Jul 19 '05 #4

P: n/a
On Mon, 20 Oct 2003 13:17:02 -0700, Stefan Berglund
<ke****@in.thegroups> wrote:
in <v9********************************@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.
Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.