Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Is there a way to include js file from another js?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

GoodMorningSky
Junior Member

122 Posts

Posted - 01 April 2005 :  18:09:11  Show Profile
I create several js file. Each containing different kinds of functions.

object.js
String.prototype.rTrim = string_RTrim;
function string_RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
		return"";
	}
	var iTemp = v_length -1;

	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;
	} //End While
	return strTemp;

} //End Function



Validate.js file:
//import object.js // is this possible or any way?

function Validate(targetVal){
  //I want to use following
  var aResult = targetVal.rTrim();
}



Validate.java code uses function defined in object.js.
I can put all into one js file: this is not I want.

Is any idea or any proper or industry standard pattern for this kind of issue?

Software Engineer.
MCSD.NET, SCWCD

Davio
Development Team Member

Jamaica
12217 Posts

Posted - 01 April 2005 :  20:01:57  Show Profile
Nope. Can't include a file into a javascript file.
You will have to include both javascript files into your ASP or HTML page.

Support Snitz Forums
Go to Top of Page

GoodMorningSky
Junior Member

122 Posts

Posted - 04 April 2005 :  19:52:21  Show Profile
Thank you I got it!

Software Engineer.
MCSD.NET, SCWCD
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 07 April 2005 :  13:07:58  Show Profile
Or, if you really want to, use a document.write in your javascript file, e.g. ...

document.write("<script type=\"text\/javascript\" src=\"object.js\"><\/script>");


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.32 seconds. Powered By: Snitz Forums 2000 Version 3.4.07