-
Can JavaScript files be included into ASP scripts using <- -! include directive
Hi folks,
I'm a novice ASP programmer. I have a question regarding including
files in ASP code. What kind of files could be included into ASP scripts
to get the functionality into the currect ASP code. Can javascript code files
be included into ASP scripts and can the functionality provided by javascript
files used in this way? An early answer wud be appreciated.
Thanks,
Shravan
-
Re: Can JavaScript files be included into ASP scripts using <- -! include directive
Kent,
I have tried having this <%@ LANGUAGE="JavaScript" %> into the normal
.js file and then included that file into my aso code. It gave my an error.
And if I remove <%@ LANGUAGE="JavaScript" %> from my .js code it prints all
the code insode my .js file when I refresh the web page...
Why is this happening? Plz help
Thanks,
Shravan
"Kent" <file_delete@hotmail.com> wrote:
>Shraven,
>
>The <% #include... directive is processed before any code in your ASP file
>is executed.
>
>ASP V3.0 (IIS 5.0/Win2000) will process VBScript and JScript (almost
>identical to JavaScript) right out of the box.
>
>So yes, you can include JavaScript files and then use their functionality
>server-side.
>
>Most folks will write server-side code in VBScript and client-side code
in
>JScript.
>
>HTH
>Kent
>
>"shravan" <shravan79@hotmail.com> wrote in message
>news:3dac6ab7$1@10.1.10.29...
>>
>> Hi folks,
>> I'm a novice ASP programmer. I have a question regarding
>including
>> files in ASP code. What kind of files could be included into ASP scripts
>> to get the functionality into the currect ASP code. Can javascript code
>files
>> be included into ASP scripts and can the functionality provided by
>javascript
>> files used in this way? An early answer wud be appreciated.
>>
>> Thanks,
>> Shravan
>>
>
>
-
Re: Can JavaScript files be included into ASP scripts using <- -! include directive
Shraven,
The <% #include... directive is processed before any code in your ASP file
is executed.
ASP V3.0 (IIS 5.0/Win2000) will process VBScript and JScript (almost
identical to JavaScript) right out of the box.
So yes, you can include JavaScript files and then use their functionality
server-side.
Most folks will write server-side code in VBScript and client-side code in
JScript.
HTH
Kent
"shravan" <shravan79@hotmail.com> wrote in message
news:3dac6ab7$1@10.1.10.29...
>
> Hi folks,
> I'm a novice ASP programmer. I have a question regarding
including
> files in ASP code. What kind of files could be included into ASP scripts
> to get the functionality into the currect ASP code. Can javascript code
files
> be included into ASP scripts and can the functionality provided by
javascript
> files used in this way? An early answer wud be appreciated.
>
> Thanks,
> Shravan
>
-
Re: Can JavaScript files be included into ASP scripts using <- -! include directive
you can only have one
<%@ LANGUAGE=... declaration.
Here's a working example of javascript includes and server-side javascript:
File-main.asp:
-----------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ LANGUAGE="JavaScript"%>
<html>
<head>
<title>Default!</title>
<!--#include file="myScript.js"-->
</head>
<body>
<%
// do JavaScript stuff here
Response.Write ("Hello World!");
%>
<hr>
<%
// do JavaScript stuff here
Response.Write ( sum_it(10, 15) );
%>
</body>
</html>
-----------------------------
File-myScript.js:
-----------------------------
<%
function sum_it(var1, var2) {return var1 + var2;}
%>
-----------------------------
Note that the code that is run on the server side is contained with-in the
ASP delimiters (<% & %>).
To include client side code, try:
<script language="Javascript" src="your.js" type="text/javascript"></script>
-----
Kent
-----
"Shravan" <shravan79@yahoo.com> wrote in message
news:3dac8912$1@10.1.10.29...
>
> Kent,
> I have tried having this <%@ LANGUAGE="JavaScript" %> into the normal
> js file and then included that file into my aso code. It gave my an error.
> And if I remove <%@ LANGUAGE="JavaScript" %> from my .js code it prints
all
> the code insode my .js file when I refresh the web page...
> Why is this happening? Plz help
>
> Thanks,
> Shravan
>
>
>
>
> "Kent" <file_delete@hotmail.com> wrote:
> >Shraven,
> >
> >The <% #include... directive is processed before any code in your ASP
file
> >is executed.
> >
> >ASP V3.0 (IIS 5.0/Win2000) will process VBScript and JScript (almost
> >identical to JavaScript) right out of the box.
> >
> >So yes, you can include JavaScript files and then use their functionality
> >server-side.
> >
> >Most folks will write server-side code in VBScript and client-side code
> in
> >JScript.
> >
> >HTH
> >Kent
> >
> >"shravan" <shravan79@hotmail.com> wrote in message
> >news:3dac6ab7$1@10.1.10.29...
> >>
> >> Hi folks,
> >> I'm a novice ASP programmer. I have a question regarding
> >including
> >> files in ASP code. What kind of files could be included into ASP
scripts
> >> to get the functionality into the currect ASP code. Can javascript code
> >files
> >> be included into ASP scripts and can the functionality provided by
> >javascript
> >> files used in this way? An early answer wud be appreciated.
> >>
> >> Thanks,
> >> Shravan
> >>
> >
> >
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks