473,500 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

class libraries

it there as way to build class library's of functions and stuff that can be
used in javascript likein vb.net or c#

WStoreyII
Jul 23 '05 #1
2 1113
JavaScript does not really have classes, but yes, you can include
external javascript files:

<script language="JavaScript" src="myexternal.js"></script>

Note that this can only be done in HTML.

WStoreyII wrote:
it there as way to build class library's of functions and stuff that can be
used in javascript likein vb.net or c#

WStoreyII


Jul 23 '05 #2
WStoreyII wrote:
it there as way to build class library's of functions and stuff that can be
used in javascript likein vb.net or c#

WStoreyII


Sure. Create your objects with their associated methods and properties, put
them in a .js file and include them on your page with:

<head>
<!-- other stuff -->
<script type="text/javascript" src="MyDictionary.js"></script>
</head>

Then in MyDictionary.js you might have:

function MyDictionary() {
this.RemoveAll();
}
MyDictionary.prototype.RemoveAll = function() {
this.obj = {};
this.Count = 0;
}
MyDictionary.prototype.Add = function(key, value) {
if (this.obj[key] != null) {
return null;
}
this.obj[key] = value;
this.Count++;
return value;
}
MyDictionary.prototype.Exists = function(key) {
return (this.obj[key] != null);
}
// etc

And you could use it in your page like this:

<script type="text/javascript">
var y = new MyDictionary();
y.Add ("a", "test");
if (y.Exists("a")) {
document.write("a exists in MyDictionary");
}
</script>

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 23 '05 #3

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

Similar topics

0
1033
by: TF | last post by:
I am developing a VB.net Windows Application in. I have a class 'A' defined in a class library 'CL_A' and another class 'B' in a different class library 'CL_B'. Class 'B' has a Public Shared member...
1
335
by: TF | last post by:
I am developing a Windows Application in VB.NET that is using two class libraries CL_A (contains class A) & CL_B (contains class B). Also CL_A is used in CL_B. Now in my application when i try...
1
2768
by: rinku24 | last post by:
We have two C++ libraries (Unix Shared objects) with the same class name and no namespace. Is there any way to load both the libraries and selectivly create the instance of the class from...
3
2868
by: Florida Coder | last post by:
I have the need to store some application specific configuration data to be used by a class library and or a windows service. I would like to do this in a fashion similar to the way we do with...
1
258
by: Jim Heavey | last post by:
I have a web application which accesses Class Libraries in another project. Can I add an "App.config" file to my Class Libraries project and be able to use that configuration information from my...
10
3463
by: 4MLA1FN | last post by:
i'm somewhat of a c++ newbie. i'm linking some static libraries into my app. it turns out that two of the libraries (from different suppliers) share a class name; e.g. they both have a class...
3
18519
by: Fernando Chilvarguer | last post by:
Hello! I created a Class Library project in VS2005. Then, using VS, I was able to add a connection string to the project settings, which automaticaly created an app.config file for me. If I try...
2
4220
by: Mike | last post by:
In the previous version of the .net framework, system.configuration.configuration manager was available for use in Class Libraries. I'm now working with VS2005/framework 2.0 and it appears that...
4
2876
by: Richard | last post by:
First question - let's get this out of the way since it might be the solution to all my woes: Does it make sense to have a .cpp file for a class that is declared as having pure virtual functions...
3
2209
by: djbaker | last post by:
Greetings, I am trying to create a class library/dll with C++ and I am running into a lot of trouble. I know that this is a C++ forum and not one specific to windows or VS 2005 but I'm hoping...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7014
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...
0
7180
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
5485
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,...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
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 ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
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...

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.