473,327 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Output in the wrong place

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

Jul 22 '05 #1
6 1181
hc*******@gmail.com wrote:
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?
No. However, you can simply use <% ... %> tags to enclose the server-side
code block.

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
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #2
Bob Barrows [MVP] wrote on 24 jun 2005 in
microsoft.public.inetserver.asp.general:
I'm using <script language="vbscript" runat="server"> tag to enclose
the ASP Code. Does it have anything to do?


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.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #3
Evertjan. wrote:
Bob Barrows [MVP] wrote on 24 jun 2005 in
microsoft.public.inetserver.asp.general:
I'm using <script language="vbscript" runat="server"> tag to enclose
the ASP Code. Does it have anything to do?
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


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.
<snip> <% myVBSpart() %>


should be
<%= myVBSpart() %>

;-)

Bob
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #4
Bob Barrows [MVP] wrote on 25 jun 2005 in
microsoft.public.inetserver.asp.general:
Evertjan. wrote:
Bob Barrows [MVP] wrote on 24 jun 2005 in
microsoft.public.inetserver.asp.general:
I'm using <script language="vbscript" runat="server"> tag to
enclose the ASP Code. Does it have anything to do?

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


Yes, I forgot to say "if your default server-side language
is vbscript".


even better frazed.

<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.
<snip>
<% myVBSpart() %>


should be
<%= myVBSpart() %>


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

Bob


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #5
hc*******@gmail.com wrote:
<table>
<script language="vbscript" runat="server">


This is an order-of-execution issue:
http://aspfaq.com/show.asp?id=2045

A good rule of thumb is to encapsulate into functions *EVERYTHING* inside a
<script runat="server"> block.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #6
Evertjan. wrote:
<snip>
<% myVBSpart() %>


should be
<%= myVBSpart() %>


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

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: flamesrock | last post by:
First, I'm very new to gui programming, so please go lightly on me :) Ok, so far I've settled on wxPython, and what I'd like to do as a first leap is *convert* a text program into a gui program....
5
by: Tom Lam lemontea | last post by:
Hi all, This is my very first post here, I've seriously tried some programming on C, and shown below is my very first program(So you can expect it to be very messy) that I wrote after I've learned...
4
by: Miro | last post by:
Vb2003, im still learning vb.net but I do not understand my output from this logic. If someone can help me out here. Cor Ligthert, you I believe were on the right track of what Im trying to...
9
by: rkk | last post by:
Hi, I have written a generic mergesort program which is as below: --------------------------------------------------------- mergesort.h ----------------------- void MergeSort(void...
4
by: garyusenet | last post by:
Hi. I am trying to learn about array lists, and found an example on MSDN. I tried to compile it but it's not producing any output. I can't see why. Any ideas? Here is what I did. 1....
15
by: Giff | last post by:
Hi again, I need a suggestion. Right now I am developing an application and I want to be able to output on screen some variables. Anyway, I want to remove these output operations when passing...
19
by: Dancefire | last post by:
Hi, everyone It might be a simple question, but I really don't know the answer. char c = '1'; cout << c; The above code will only output a '1' rather than 0x31; If I use int cast, it can...
87
by: pereges | last post by:
I have a C program which I created on Windows machine. I have compiled and executed the program on windows machine and it gives me the consistent output every time i run it. for eg. input a = 2,...
3
by: Curious | last post by:
I''ve created a simple Console Application in C#.NET (.NET 2.0), and I have the following code: Console.WriteLine("Now let us begin!"); However, the string, "Now let us begin!", never shows up...
27
by: CarlosMB | last post by:
Hello, I am writing code that uses a DLL which is supposed to print to console some useful information but for some reason it is not doing so. The environment is a bit complex to explain but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.