473,624 Members | 2,323 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 1125
JavaScript does not really have classes, but yes, you can include
external javascript files:

<script language="JavaS cript" 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="MyDictiona ry.js"></script>
</head>

Then in MyDictionary.js you might have:

function MyDictionary() {
this.RemoveAll( );
}
MyDictionary.pr ototype.RemoveA ll = function() {
this.obj = {};
this.Count = 0;
}
MyDictionary.pr ototype.Add = function(key, value) {
if (this.obj[key] != null) {
return null;
}
this.obj[key] = value;
this.Count++;
return value;
}
MyDictionary.pr ototype.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*****@agrico reunited.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
1046
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 'm_A' of type 'A'. So it is like, class library CL_A: -------------------- public class A public x as String
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 to set a variable, declared in CL_B, of type CL_A.A to another variable, declared in application, of same type CL_A.A it gives me following error though both types are same. error BC30311: Value of type 'CL_A.A' cannot be converted to 'CL_A.A'
1
2783
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 different library? e.g. We have class Process in libABC.so and libXYZ.so. Can I instantiate object of class Process from libABC.so or libXYZ.so by specifying symbol name or some other way?? I know can do that for global function using dlsym...
3
2879
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 applications and web services without having to use the machine.config file. I know that I could use the code below to do this but the problem then becomes that when using a shared assembly both the assembly and the config file need to be put...
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 web application which has a reference to the Class Libraries project? My issue is the connection string to my database. I have been placing it into the web config file and having my web application read it an pass it to the class out of the...
10
3480
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 named 'SomeClass'. the compiler/linker is complaining. is there an easy way deal with this so my app can link? thanks.
3
18525
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 to access the configuration using System.Configuration.ConfigurationManager, I get a NullException. The code: string connectionString =
2
4230
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 this is not an option. Why is this class unavailable now in Class Libraries? I need it to reference a machine.config key on my webserver. Thanks.
4
2893
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 in its .h file? Here's my predicament. I'll put this in general terms since it's happening across several classes. I have a base class, let's say it's named A. In A.h I DECLARE several pure virtual ( = 0) functions, a virtual destructor, and...
3
2216
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 someone call help me. I would like to create a class library so that I can put classes that I reuse a lot into their own modules. I played around with it for awhile and had no luck. It was really easy to do in C# but C++ does not seem to be so...
0
8242
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8177
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
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6112
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
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...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1488
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.