2016年6月21日 星期二

CRM2011 JavaScript Load up CSS file

CRM2011 JavaScript Load up CSS file



1.Attach the following code to the web resource






2.Add the function to the priority on-change and to form onload (Call the function in an existing onload)



  1. function OnLoadForm(){
  2.  
  3.     this.LoadCSS("/WebResources/css_form_opportunity.css");
  4.  
  5. }
  6.  
  7.  
  8.  
  9. function LoadCSS(path) {
  10.  
  11.     var head = document.getElementsByTagName('head')[0];
  12.  
  13.     var link = document.createElement('link');
  14.  
  15.     link.rel = 'stylesheet';
  16.  
  17.     link.type = 'text/css';
  18.  
  19.     link.href = path;
  20.  
  21.     link.media = 'all';
  22.  
  23.     head.appendChild(link);
  24.  
  25. }
  26.  



沒有留言:

張貼留言