Problem with <script> tag using runat=server and src attributes

Discussion in 'Javascript' started by John MacIntyre, Sep 29, 2003.

  1. Hi,

    I am having a problem executing server side javascript.

    For some reason the script tag is ignored when the runat=server is combined
    with the src attribute. The code is being used client side also, so
    embedding it right into the page is not an option.

    I have also tried the following code without success.
    <script language=javascript runat=server>
    <!-- #include file="T.js" -->
    </script>

    The problem is issolated in the following example.

    Thanks in advance.,
    John MacIntyre
    VC++ / VB / ASP / Database Developer
    http://www.johnmacintyre.ca


    ---------------------------
    T.asp
    ---------------------------
    <%@ Language=VBScript %>
    <html>
    <script language=javascript runat=server src="T.js"></script>
    <script language=javascript runat=server>
    function local_calcTotal( nA, nB)
    {
    return (nA + nB);
    }
    </script>
    <body>
    <%=now()%></P>
    local calc : <%=local_calcTotal( 2, 2)%></P>
    remote calc : <%=remote_calcTotal( 2, 2)%></P>
    </body>
    </html>

    -----------------------
    T.js
    -----------------------
    function remote_calcTotal( nA, nB)
    {
    return (nA + nB);
    }
    John MacIntyre, Sep 29, 2003
    #1
    1. Advertising

  2. "John MacIntyre" <> writes:

    > I am having a problem executing server side javascript.
    >
    > For some reason the script tag is ignored when the runat=server is combined
    > with the src attribute. The code is being used client side also, so
    > embedding it right into the page is not an option.


    I don't believe earlier ASP versions works with src attributes on its
    script tags, but IIS 5.0 should accept it.

    <URL:http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q224/9/63.ASP&NoWebContent=1>

    /L 'No, I didn't know that, but Google did.'
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
    Lasse Reichstein Nielsen, Sep 29, 2003
    #2
    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. Giscard

    runat=server on HTC defined tag.

    Giscard, Aug 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    356
    Giscard
    Aug 8, 2003
  2. shruds
    Replies:
    1
    Views:
    778
    John C. Bollinger
    Jan 27, 2006
  3. André
    Replies:
    2
    Views:
    717
    André
    Jun 23, 2008
  4. Soren Vejrum
    Replies:
    4
    Views:
    566
    Lasse Reichstein Nielsen
    Jul 5, 2003
  5. Randell D.

    Using <script src> tag, is type required?

    Randell D., Dec 24, 2003, in forum: Javascript
    Replies:
    4
    Views:
    118
    Randell D.
    Dec 25, 2003
Loading...

Share This Page