View Full Version : How to include a method in a js file in the html page
phani
05-11-2003, 11:52 AM
Hi,
I have a html page which uses a method in a js file. I can do it but i want to know if there is a method with the same name in two js files and i want to include the method of a particular js file. how can i do it. any help?
Here i want to include both the js files in the html file according to the requirements
brothercake
05-11-2003, 01:36 PM
Even with the same name, they're surely not methods of the same object, so you can call the one you want with its instantiated name, no?
phani
05-11-2003, 01:44 PM
Hi brothercake,
I have really no idea of it can u give the code of how to instantiate.
phani.
brothercake
05-11-2003, 01:51 PM
I don't know cos I haven't seen your methods. But if you do something like
var person = new FatLady;
and then you have sing() as a method of FatLady, then the instantiated name would be person.sing()
phani
05-11-2003, 02:09 PM
Do you mean here fatLady is a .js file.
Here is my script. here the both the js files are containing the method check() but the code in both of them are different. I want to call the method check() in the validation.js file how can i do it.
<script language="javascript" src="D:\project\validation.js">
</script>
<script language="javascript" src="D:\project\valid.js">
</script>
<script>
function isDatevalid()
{
check(); // is this way to call the method in validation.js file
}
</script>
brothercake
05-11-2003, 07:52 PM
No in that example FatLady is an object.
What's in the JS files?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.