User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,146 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,154 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1365 | Replies: 3
Reply
Join Date: May 2007
Posts: 23
Reputation: thirunavukaras is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
thirunavukaras thirunavukaras is offline Offline
Newbie Poster

Question i want to declare header file in javascript

  #1  
May 22nd, 2007
hai

i want declare

imports system.net -----header file in javascript

<script>
//// in this section how to declare imports system.net
<script>

please help me
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: Birmingham, AL
Posts: 33
Reputation: azimuth0 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 5
azimuth0 azimuth0 is offline Offline
Light Poster

Re: i want to declare header file in javascript

  #2  
May 22nd, 2007
It won't work like you want. Try this instead:
<script type="text/javascript" lang="Javascript" src="headerfile.js"/>
<script>
// your script
</script>
Reply With Quote  
Join Date: May 2007
Posts: 23
Reputation: thirunavukaras is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
thirunavukaras thirunavukaras is offline Offline
Newbie Poster

Question Re: i want to declare header file in javascript

  #3  
May 23rd, 2007
i want to declare the header file in javascript.....

please help me.....
Reply With Quote  
Join Date: May 2005
Location: Wellington, New Zealand
Posts: 182
Reputation: alpha_foobar is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 3
alpha_foobar's Avatar
alpha_foobar alpha_foobar is offline Offline
Junior Poster

Re: i want to declare header file in javascript

  #4  
May 23rd, 2007
You can't "import" a javascript file with a javascript file.

There is an import (and export) keyword in the javascript, but these are used for visibility of members.

I wrote some code to import libraries as the user required them... but its pretty rough. This should theoretically allow dynamic importing. But if you know what you want to use, then just use the <script src="xxx.js" language="javascript> tag.

		<script type="text/javascript">

			function importLibFile(file){
				var e = document.createElement("script");
				e.src = file;
				e.type="text/javascript";
				document.getElementsByTagName("head")[0].insertBefore(e, document.getElementsByTagName("script")[0]);
			}

			function applicationRegister(appName, appFunction){
				document.applications[appName] = appFunction;
				document.applications[document.applications.length] = appName;
			}

			function init(){
				document.applications = new Array();
				document.libraries	  = new Array();
			}


			function setKeyListener(node, listener){
				node.onkeydown = listener;
				node.onkeyup = null;
			}

			function dropKeyListener(node){
				node.onkeydown = null;
				node.onkeyup = null;
			}

			function registerMainFunc(name, func){
				// threading would be nice here.
				function loadApplication(){
					try {
						applicationRegister(name, func);
					} catch(exception) {
						// while appfunction doesn't load
						setTimeout(function(){ registerMainFunc(name, func); }, 250);
					}
				};
			}

			function loadApplication(name, func, libFile){
				if(document.libraries && !document.libraries[libFile]){
					document.libraries[libFile] = true;
					importLibFile(libFile);
				}
				if(document.applications && !document.applications[name]){
					applicationRegister(name, func);
				} else {
					alert("web.sh: " + name + " already exists.");
				}
			}

			onload = function(){
				init();
				loadApplication("wevents", function(args, out){ __wevents_init(args, out); }, "javascript/wevents.js");
				loadApplication("clear", function(args, out){ __websh_clear(args, out); }, "javascript/webshutils.js");
				loadApplication("terminal", function(args, out){ __websh_terminal(args, out); }, "javascript/webshutils.js");
				loadApplication("yubnub", function(args, out){ __yubnub_init(args, out); }, "javascript/yubnub.js");
				loadApplication("wjsc", function(args, out){ __wjsc_main(args, out); }, "javascript/wjsc.js");
			}
		</script>
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 6:53 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC