Output in the wrong place

Discussion in 'ASP General' started by hcastanho@gmail.com, Jun 24, 2005.

  1. Guest

    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
    , Jun 24, 2005
    #1
    1. Advertising

  2. 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"
    Bob Barrows [MVP], Jun 24, 2005
    #2
    1. Advertising

  3. Evertjan. Guest

    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)
    Evertjan., Jun 25, 2005
    #3
  4. 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"
    Bob Barrows [MVP], Jun 25, 2005
    #4
  5. Evertjan. Guest

    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)
    Evertjan., Jun 25, 2005
    #5
  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"
    Bob Barrows [MVP], Jun 25, 2005
    #6
    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. Mike Nishizawa
    Replies:
    0
    Views:
    321
    Mike Nishizawa
    Apr 15, 2004
  2. UJ
    Replies:
    2
    Views:
    293
    Kevin Spencer
    Jul 8, 2006
  3. Replies:
    0
    Views:
    771
  4. amchimam

    Hyperlink is going to wrong place

    amchimam, Aug 1, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    330
  5. Afshar
    Replies:
    2
    Views:
    666
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Nov 3, 2006
Loading...

Share This Page