Link to home
Start Free TrialLog in
Avatar of djschaap
djschaap

asked on

Shared Libraries with ASP / WSH

I'm developing a library of JavaScript functions (could just as easily be VBScript).  Right now, they're in a file called lib.js that can be included in a WSH .wsf file via the SCRIPT tag.

If I convert lib.js file to lib.asp by adding SCRIPT tags within the file itself, I can include lib.asp in other ASP scripts (but then I can no longer use it with WSH).

I hate the thought of manually keeping these two files in sync.  While I could write a short script to add the necessary wrapper around the .js file, that's an ugly hack at best.  How can I combine lib.js & lib.asp into ONE file that can be included from BOTH ASP and WSH?
Avatar of sybe
sybe

i never tried this, but create 2 files for include with asp, with just the tags.

===========
file starttag.inc
===========
<%
===========

===========
file endtag.inc
===========
%>
===========

then in asp include like this:
<!--#include file="starttag.inc"-->
<!--#include file="yourlib.asp"-->
<!--#include file="endtag.inc"-->
Avatar of djschaap

ASKER

Nice thought, but:

using <%  %> tags:
Active Server Pages, ASP 0116 (0x80004005)
The Script block lacks the close of script tag (%>).
/.../start.inc, line 1

using SCRIPT tags:
Active Server Pages, ASP 0117 (0x80004005)
The Script block lacks the close of script tag (</SCRIPT>) or close of tag symbol (>).
/.../start.inc, line 1


Thanks for trying!
and what about using the html <script> tag in your asp:

<script scr="yourlib.asp" language="jscript" runat="server"/>

(never tried that either...)
no, that sounds weird, it's a client tag, won't work.
Nice thought, but:

using <%  %> tags:
Active Server Pages, ASP 0116 (0x80004005)
The Script block lacks the close of script tag (%>).
/.../start.inc, line 1

using SCRIPT tags:
Active Server Pages, ASP 0117 (0x80004005)
The Script block lacks the close of script tag (</SCRIPT>) or close of tag symbol (>).
/.../start.inc, line 1


Thanks for trying!
ASKER CERTIFIED SOLUTION
Avatar of sybe
sybe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
(Please ignore my extra comments -- reload does more than I thought!)
so:....

did it work ?? because i think you got a working answer.
if so, then pls close this question.
That worked!  Thanks.