473,799 Members | 3,072 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3481
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='javas cript' 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*******@optus net.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*******@optus net.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*******@optu snet.com.auwrot e in message
news:11******** **************@ m73g2000cwd.goo glegroups.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
4671
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 include references in such a way that I don't have to change them all every time I have to publish to the production server 2. Setup above in such a way that won't involve php.ini (& LInux equivalent), as I have access to edit this file...
1
1436
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 x { }
21
3395
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 function. DO: $var = null; DONT DO: unset($var);
6
13672
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
1341
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 directories to be searched for headers? contents of directory1: file1.c: #include "file1.h" int main(void) { return 0; }
6
1339
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
1017
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 where I am supposed to insert this statement. Sean
14
22374
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
13727
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 the source for the link that generates the error: <a href="./procedures/ODBC_installation.pdf">ODBC driver installation procedure</a><br /> The permissions on the file and the directory containing it are wide
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10484
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10228
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.