+ Start a Discussion
soasoa 

How should I include multiple js Files?

Hi,
 
If I have multiple js Files , How should I include them ?
 
In refrence to Salesforce-Apex-Language-Refrence , page no -21, they have written a S-control for the Apex Code:
 
Apex Code:
Code:
global class HelloWorld2 {
// The WebService keyword makes this a public WebService method
WebService static String sayHelloWorld(String arg) {
// This method returns a simple message
return 'Hello '+arg;
}
}

 
Code for S-control:
Code:
<html>
<head>

<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/11.0/connection.js"></script>
<script src="/soap/ajax/11.0/apex.js"></script>
<script>
function demo() {
var result = sforce.apex.execute('HelloWorld2' , 'sayHelloWorld',
{arg:"new Apex user!"});
document.getElementById('userNameArea').innerHTML = 'Congratulations!'
+ ' ' + result;
}
</script>
</head>
<body onload=demo()>
<div id=userNameArea>
</div>
</body>
</html>

 
Where in Force.com have they included Functions.js?
 
How should I include multiple js Files?
 
Please help.
 
Regards
Diti
werewolfwerewolf
In the code you specified there are in fact 3 js files that are included.  You probably don't need functions.js.  For the other includes, you should use the !REQUIRESCRIPT merge field so that it'll kind of make the includes for you.
soasoa

Hi,

Thanks for the Reply. But please tell me how do I include these js files in Force.com.

I mean to say where will these files be located,so that my REQUIRESCRIPT  will find them.

Please help.

 

Regards

Diti

 

werewolfwerewolf
These files are located on Salesforce.com's servers.  Just use REQUIRESCRIPT and it will find them – you don't have to add them yourself.