By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,417 Members | 1,845 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,417 IT Pros & Developers. It's quick & easy.

How To include a js file ?

P: n/a
Hi,

With asp, I used to use the following line
<Script language="javascript" src="<%=JsFile%>"></script>

I would like to know how this can be done with asp.net ?
Thanks

Stan
Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
<script language="javascript" src="script.js"></script>

Eliyahu

"Stan Sainte-Rose" <st**@cyber972.com> wrote in message
news:uW**************@TK2MSFTNGP11.phx.gbl...
Hi,

With asp, I used to use the following line
<Script language="javascript" src="<%=JsFile%>"></script>

I would like to know how this can be done with asp.net ?
Thanks

Stan

Nov 18 '05 #2

P: n/a
you can still use the same with asp.net. but JsFile needs to be hardcoded
properly. Or if you want to come out of the ASP world completely,
use user controls in place of include files.

Av.
"Stan Sainte-Rose" <st**@cyber972.com> wrote in message
news:uW**************@TK2MSFTNGP11.phx.gbl...
Hi,

With asp, I used to use the following line
<Script language="javascript" src="<%=JsFile%>"></script>

I would like to know how this can be done with asp.net ?
Thanks

Stan

Nov 18 '05 #3

P: n/a
Hi Eliyahu,

it is not what I m really looking for..
In fact, jsfile is a variable...

So, it would be something like this..
<script id="JSFILE" language="javascript" runat="server"></script>

and I would like to change the src tag like this

JSFILE.src.value=myvariable
So I don't know if it's possible..
and if it's, how to declare the ID in the asp.vb file

Stan


"Eliyahu Goldin" <re*************@monarchmed.com> a écrit dans le message de
news: #$*************@TK2MSFTNGP10.phx.gbl...
<script language="javascript" src="script.js"></script>

Eliyahu

"Stan Sainte-Rose" <st**@cyber972.com> wrote in message
news:uW**************@TK2MSFTNGP11.phx.gbl...
Hi,

With asp, I used to use the following line
<Script language="javascript" src="<%=JsFile%>"></script>

I would like to know how this can be done with asp.net ?
Thanks

Stan


Nov 18 '05 #4

P: n/a
A GenericControl in the worst case. You could also use the
RegisterClientScript method (not sure of the exact name) to "inject" this
script block in the HTML output, especially if this script is needed by a
particular "component" of your app.

Patrice
"Stan Sainte-Rose" <st**@cyber972.com> a écrit dans le message de
news:um**************@TK2MSFTNGP09.phx.gbl...
Hi Eliyahu,

it is not what I m really looking for..
In fact, jsfile is a variable...

So, it would be something like this..
<script id="JSFILE" language="javascript" runat="server"></script>

and I would like to change the src tag like this

JSFILE.src.value=myvariable
So I don't know if it's possible..
and if it's, how to declare the ID in the asp.vb file

Stan


"Eliyahu Goldin" <re*************@monarchmed.com> a écrit dans le message de news: #$*************@TK2MSFTNGP10.phx.gbl...
<script language="javascript" src="script.js"></script>

Eliyahu

"Stan Sainte-Rose" <st**@cyber972.com> wrote in message
news:uW**************@TK2MSFTNGP11.phx.gbl...
Hi,

With asp, I used to use the following line
<Script language="javascript" src="<%=JsFile%>"></script>

I would like to know how this can be done with asp.net ?
Thanks

Stan



Nov 18 '05 #5

P: n/a
Sorry for not reading your mail properly.
You can set the src tag on client side with statement

document.getElementById("JSFILE").src=myvariable;

There are numerous ways of passing values from server to client side, so
setting myvariable to what you need is not a problem.

Eliyahu

"Stan Sainte-Rose" <st**@cyber972.com> wrote in message
news:um**************@TK2MSFTNGP09.phx.gbl...
Hi Eliyahu,

it is not what I m really looking for..
In fact, jsfile is a variable...

So, it would be something like this..
<script id="JSFILE" language="javascript" runat="server"></script>

and I would like to change the src tag like this

JSFILE.src.value=myvariable
So I don't know if it's possible..
and if it's, how to declare the ID in the asp.vb file

Stan


"Eliyahu Goldin" <re*************@monarchmed.com> a écrit dans le message de news: #$*************@TK2MSFTNGP10.phx.gbl...
<script language="javascript" src="script.js"></script>

Eliyahu

"Stan Sainte-Rose" <st**@cyber972.com> wrote in message
news:uW**************@TK2MSFTNGP11.phx.gbl...
Hi,

With asp, I used to use the following line
<Script language="javascript" src="<%=JsFile%>"></script>

I would like to know how this can be done with asp.net ?
Thanks

Stan



Nov 18 '05 #6

P: n/a
I thank you Eliyahu & Patrice..

I ve found something..
http://www.ondotnet.com/pub/a/dotnet...15/aspnet.html
Stan

"Eliyahu Goldin" <re*************@monarchmed.com> a écrit dans le message de
news: ee**************@TK2MSFTNGP09.phx.gbl...
Sorry for not reading your mail properly.
You can set the src tag on client side with statement

document.getElementById("JSFILE").src=myvariable;

There are numerous ways of passing values from server to client side, so
setting myvariable to what you need is not a problem.

Eliyahu

"Stan Sainte-Rose" <st**@cyber972.com> wrote in message
news:um**************@TK2MSFTNGP09.phx.gbl...
Hi Eliyahu,

it is not what I m really looking for..
In fact, jsfile is a variable...

So, it would be something like this..
<script id="JSFILE" language="javascript" runat="server"></script>

and I would like to change the src tag like this

JSFILE.src.value=myvariable
So I don't know if it's possible..
and if it's, how to declare the ID in the asp.vb file

Stan


"Eliyahu Goldin" <re*************@monarchmed.com> a écrit dans le
message de
news: #$*************@TK2MSFTNGP10.phx.gbl...
<script language="javascript" src="script.js"></script>

Eliyahu

"Stan Sainte-Rose" <st**@cyber972.com> wrote in message
news:uW**************@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> With asp, I used to use the following line
> <Script language="javascript" src="<%=JsFile%>"></script>
>
> I would like to know how this can be done with asp.net ?
>
>
> Thanks
>
> Stan
>
>



Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.