473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to include a js file globally in asp.net

Hi there,
I'd like to know how to include a js file globally in asp.net so all my
pages can access js functions in this file. (Only include it once and
not include
this file one by one to all my pages.)

Thanks for your help.

Green

Aug 29 '06 #1
5 3431
KJ
Hello there,

If you're using .NET 2.0, you can include the js file in a master page.
If using 1.x, you will have to include it in each page via the <script
language='javascript' src="myjs.js"></scripttagging.

Alternatively, you can place the entire site as the src of a
single-framed frameset, and include the script tags in the frameset
page; then, when you call your js methods, always call
top.methodname(), since the frameset page is the top.

gr*******@optusnet.com.au wrote:
Hi there,
I'd like to know how to include a js file globally in asp.net so all my
pages can access js functions in this file. (Only include it once and
not include
this file one by one to all my pages.)

Thanks for your help.

Green
Aug 29 '06 #2
Thanks a lot KJ.

I guess I am going to include it in the frameset as I am use frames.

Thanks for you help.

Green.

Aug 29 '06 #3
Hi,

gr*******@optusnet.com.au wrote:
Thanks a lot KJ.

I guess I am going to include it in the frameset as I am use frames.

Thanks for you help.

Green.
Including a script file in the frameset is often a bad idea. Remember
that each frame and the frameset itself are separate windows, so if the
script runs in the frameset, you must use inter-window communication,
which complicates the whole process.

In the contrary, masterpages and their content run, eventually, in one
single window, so you won't have that issue.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 29 '06 #4
<gr*******@optusnet.com.auwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I guess I am going to include it in the frameset as I am use frames.
I concur with what Laurent said, and really advise you not to do that.

Use MasterPages instead.
Aug 29 '06 #5
Thanks Mark and Laurent and everyone who helped me.

I am new to ASP.NET, it seems I have a lot to learn.

Green.

Aug 30 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: JStrummer | last post by:
I have a question regarding paths and the include() statement in PHP. I develop in a Windows environment and will be publishing to a Linux server. I would like to do the following: 1. Setup my...
1
by: JoeT | last post by:
Hi... I'm using ADOdb for an application and writing a series of functions that are split across many .php files to be included as needed. If a single .php file has the following: function...
21
by: steve | last post by:
Dont’ make my mistake. It is costly. Say you have defined a variable $var in your main script. Now in a function you access it using: global $var; But you want to set it to null inside the...
6
by: Henk ten Bos | last post by:
Hi all, is there anyone who knows of a way in VB6 to have include-files (like in C: include <include.h>) ? thanks! Henk
1
by: Charles Mills | last post by:
What does the C standard (C99) say about which version of header2.h should be included in the following case - where directory1 is the current directory and directory2 is included in the list of...
6
by: Michael Roper | last post by:
I'd like have a file with all of my Win32API stuff in it: namespace myStuff.InteropTypes { using HBITMAP = System.IntPtr; using HWND = System.IntPtr; public struct POINT { public int x;
1
by: Sean Jorden | last post by:
I am trying to include a custom IDL available to the project. In VC6 I would simply import "custom.idl" at the top of my .idl file. Now, it seems this file is automatically generated - I cannot see...
14
by: Pedro Graca | last post by:
Imagine I have a structure with a size_t member: /* foo.h */ struct foo { char const *bar; size_t barlen; }; void make_foo(struct foo *p);
5
by: workingstiff19 | last post by:
I just want people to click on a link to download a file. I've done it before, but this is a new computer and I must be missing something. (Possibly an Apache configuration setting?) Here is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.