[thelist] The finer details of javascript

Rob Smith rob.smith at THERMON.com
Fri Nov 8 10:50:07 CST 2002


So Steve this is basically what your saying:

demo.asp:
<html>
<head>
<%
sub vbproc(num1,num2)
Response.Write(num1*num2)
end sub
%>
<script  language="javascript" runat="server">
function jsproc(num1,num2)
{
Response.Write(num1*num2)
}
</script>
</head>

<body>
<p>Result: <%call vbproc(3,4)%></p>
<p>Result: <%call jsproc(3,4)%></p>
</body>

</html>

Rob

-----Original Message-----
From: Steve Cook [mailto:steve.cook at evitbe.com]
Sent: Friday, November 08, 2002 10:03 AM
To: 'thelist at lists.evolt.org'
Subject: RE: [thelist] The finer details of javascript


Interesting idea Rob! I can think of one (untested) way of doing this and
another approach which I have used myself many times.

For the ASP parser to parse a file it must have the file ending in its list
of recognised endings. I don't remember exactly how you do this (it's
probably a setting in the IIS terminal), but if you add .js to the list then
all .js files will be parsed for ASP code before they are served.

Otherwise you will need to change the approach. The main page that is
"calling" the javascript file does the inclusion on the client end, not at
the server. If you cannot change the .js file so it is parses before it is
sent to the client, then you will need to generate the bits of javascript
that have dynamic content within your main asp file instead. You could
include this as part of your page header for instance so that you still gain
the benefit of recylcing your code. This is the way I have gone about doing
such things in the past.

There may be other ways of getting around this, but I know that the 2nd
version can be used.

Good luck!



-------------------------------------
 Cookstour - http://www.cookstour.org
-------------------------------------

> -----Original Message-----
> From: Rob Smith [mailto:rob.smith at THERMON.com]
> Sent: den 8 november 2002 16:39
> To: Thelist (E-mail)
> Subject: [thelist] The finer details of javascript
>
>
> Hi list,
>
> Once again, I seek your expertise. Here's the story: I've got
> an .htm page
> that has an external .js file "included." In that .js file,
> I'm trying to
> include some .asp stuff. example:
> </SNIP>
>
--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !



More information about the thelist mailing list