Output in the wrong place

H

hcastanho

Hi all

I'm looping thru an ASP FOR Cycle that populates a table, but when I
output it, the code appears before the HTM tag instead after the body
(very weird to me).
I'm using <script language="vbscript" runat="server"> tag to enclose
the ASP Code. Does it have anything to do?

Here's a code snip:

<table>
<script language="vbscript" runat="server">
for i=0 to 9
for j=0 to 1
fazContas = DateDiff("d", dataAgora, dataColeccao(i,j))
if fazContas <= 0 then
mostraResultadoTexto = livroColeccao(i,j)
mostraResultadoLivro = imgLivro(i,j)
response.Write("<tr>")
response.Write("<td>" & mostraResultadoTexto & "</td>")
response.Write("<td>" & mostraResultadoLivro & "</td>")
response.Write("</tr>")
end if
next
next
</script>
</table>

Thanks in advanced,
Hugo Castanho
 
B

Bob Barrows [MVP]

Hi all

I'm looping thru an ASP FOR Cycle that populates a table, but when I
output it, the code appears before the HTM tag instead after the body
(very weird to me).
I'm using <script language="vbscript" runat="server"> tag to enclose
the ASP Code. Does it have anything to do?


Here's a code snip:

<table>
<script language="vbscript" runat="server">
for i=0 to 9
for j=0 to 1
fazContas = DateDiff("d", dataAgora, dataColeccao(i,j))
if fazContas <= 0 then
mostraResultadoTexto = livroColeccao(i,j)
mostraResultadoLivro = imgLivro(i,j)
response.Write("<tr>")
response.Write("<td>" & mostraResultadoTexto & "</td>")
response.Write("<td>" & mostraResultadoLivro & "</td>")
response.Write("</tr>")
end if
next
next
</script>
</table>
Can you create a very short page that reproduces this symptom? I suspect
your actual page is too large to post, so if you create a test page with
only the code needed to cause your symptom, somebody should be able to test
the code and help.

Bob Barrows
 
E

Evertjan.

Bob Barrows [MVP] wrote on 24 jun 2005 in
microsoft.public.inetserver.asp.general:
No. However, you can simply use <% ... %> tags to enclose the
server-side code block.


Yes, I think it can:

If your default language for that asp page is Jscript

<script language="vbscript" runat="server">

will not be executed "inline"

try this:

=====================================

<table>

<script language="vbscript" runat="server">
function myVBSpart()
for i=0 to 9
for j=0 to 1
fazContas = DateDiff("d", dataAgora, dataColeccao(i,j))
if fazContas <= 0 then
mostraResultadoTexto = livroColeccao(i,j)
mostraResultadoLivro = imgLivro(i,j)
response.Write("<tr>")
response.Write("<td>" & mostraResultadoTexto & "</td>")
response.Write("<td>" & mostraResultadoLivro & "</td>")
response.Write("</tr>")
end if
next
next
end function
</script>

<% myVBSpart() %>

</table>

=====================================

not tested.
 
B

Bob Barrows [MVP]

Evertjan. said:
Bob Barrows [MVP] wrote on 24 jun 2005 in
microsoft.public.inetserver.asp.general:


Yes, I think it can:

If your default language for that asp page is Jscript

Yes, I forgot to say "if your default server-side language is vbscript".
<script language="vbscript" runat="server">

will not be executed "inline"
.... which is why i asked him to post a small page that reproduced the
problem.
<% myVBSpart() %>

should be
<%= myVBSpart() %>

;-)

Bob
 
E

Evertjan.

Bob Barrows [MVP] wrote on 25 jun 2005 in
microsoft.public.inetserver.asp.general:
Yes, I forgot to say "if your default server-side language
is vbscript".

even better frazed.
... which is why i asked him to post a small page that reproduced the
problem.


should be
<%= myVBSpart() %>

I don't think so
as myVBSpart() has it's own response.writes and no return value
 
B

Bob Barrows [MVP]

Evertjan. said:
I don't think so
as myVBSpart() has it's own response.writes and no return value


;-}
Damn! Didn't notice! I wish I could say that this will teach me not to reply
before having my coffee, but I'm sure it'll happen again ...

Bob
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top