//Example 1

var link = document.createElement('link');
link.rel = 'stylesheet'; link.type = 'text/css';
link.href = 'style.css'; // Get HTML head element to append document.getElementsByTagName('HEAD')[0].appendChild(link);


//Example 2

var head = document.getElementsByTagName('HEAD')[0];
var link = document.createElement('link');
link.rel = 'stylesheet'; link.type = 'text/css'; link.href = 'style.css'; 
head.appendChild(link);