Javascript in asp.net

  • Thread starter Thread starter Cheryl
  • Start date Start date
C

Cheryl

Hi,

If I have 3-pages of javascript to be put into the .net page.

The 3-pages of javascript can be separated file and it also can be put
into the .net page. Can suggest the best way to do it and how.

Thanks
Cheryl
 
You can put a reference to the JavaScript file in the HTML of your ASPX page, specifically inside the <HEAD></HEAD> tags. I generally put my global JavaScript functions in a file called 'Global.js', but you can call it anything you want, but give it a '.js' file extension. Notice below how the 'src' attribute uses an absolute path, so you can copy and paste this <script ...></script> line across all your ASPX files in your application and they will all find the script file without any problem

<HEAD><script src="/WebApplication1/Includes/Global.js" language="JavaScript"></script></HEAD

Rasika Wijayaratn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top