Wednesday, September 10, 2008

Using External JS Files


Description

In some cases, it can be very useful to use an external javascript file to separate the code from the development interface within the CRM. This can be easily done with a little bit of DOM scripting. I use this technique to improve readability and code re-usability. One thing to remember, is that external javascript files are cached until removed by the client. Therefore you need to carefully consider when to implement this technique.


Code
 
var lnk = document.createElement("script");
lnk.type = "text/javascript";
lnk.language = "javascript";
lnk.src = "/mycustomizations/js/[filename].js";
document.crmForm.appendChild(lnk);

0 comments:

 

blogger templates | Make Money Online