Greetings,
Here is my problem, I have a html file, that for simplicity
sake has one form button, and it calls tstCallerFunc() in
its onclick event.
At the top of this html file I have included two javascript
(.js) files. The first is specific to this html page, the
second does generic validation based on a given string...
[tt]
<head>
<script src="check_controls.js" type="text/javascript"></script>
<script src="validate_controls.js" type="text/javascript""></script>
</head>
[/tt]
...so the onclick calls tstCallerFunc which is located in
the check_controls.js file.
In check_controls.js I have...
[tt]
function tstCallerFunc() {
var msg1 = tstCallerInFile(); //works fine
var msg2 = tstCallerOutFile(); //fails here
alert(msg1);
alert(msg2);
}
function tstCallerInFile() {
return "Returned from within file";
}
[/tt]
...then in validate_controls.js I have...
[tt]
function tstCallerOutFile() {
return "Returned from external file";
}
[/tt]
So what happens is that when I call the function that is
within the same .js included file, it works fine. When
I try to call the other function (that is in the second
.js file) it fails and says "Object expected".
Is it not possible to call a function that is located in
a second included script file?
Any ideas on how I could make this work? (short of
consolidating the two files?)
Regards,
Tj
Here is my problem, I have a html file, that for simplicity
sake has one form button, and it calls tstCallerFunc() in
its onclick event.
At the top of this html file I have included two javascript
(.js) files. The first is specific to this html page, the
second does generic validation based on a given string...
[tt]
<head>
<script src="check_controls.js" type="text/javascript"></script>
<script src="validate_controls.js" type="text/javascript""></script>
</head>
[/tt]
...so the onclick calls tstCallerFunc which is located in
the check_controls.js file.
In check_controls.js I have...
[tt]
function tstCallerFunc() {
var msg1 = tstCallerInFile(); //works fine
var msg2 = tstCallerOutFile(); //fails here
alert(msg1);
alert(msg2);
}
function tstCallerInFile() {
return "Returned from within file";
}
[/tt]
...then in validate_controls.js I have...
[tt]
function tstCallerOutFile() {
return "Returned from external file";
}
[/tt]
So what happens is that when I call the function that is
within the same .js included file, it works fine. When
I try to call the other function (that is in the second
.js file) it fails and says "Object expected".
Is it not possible to call a function that is located in
a second included script file?
Any ideas on how I could make this work? (short of
consolidating the two files?)
Regards,
Tj