load "http://www.ilovejs.net/lab/css.php" first,but it will take two seconds to response. chage the background at div.

and then load "http://www.ilovejs.net/lab/load.css". chage the font-size and font-family


var link = document.createElement("link");
var head = document.getElementsByTagName("head")[0];
var cssnum = document.styleSheets.length;


var ti = setInterval(function() {
  //Firefox在head附加了link元素之后,length就加1了,所以Firefox会提前执行这一步。
  //而Webkit的浏览器会等到link加载完毕之后length再进行加1
  if (document.styleSheets.length > cssnum) {
    
	var l = document.createElement("link");
	var cn = document.styleSheets.length;

	var t = setInterval(function(){
	  if(document.styleSheets.length > cn){
	    alert("css loaded");
		clearInterval(t);
	  }
	},10);

	l.href="http://www.ilovejs.net/lab/css/load.css";
	l.rel="stylesheet";

	head.appendChild(l);



    clearInterval(ti);

  }
}, 10);

//link.href="http://static.youku.com/v1.0.0647/topic/css/index.css";
link.href="http://www.ilovejs.net/lab/css/css.php";
link.rel = "stylesheet";

head.appendChild(link);