Difference between revisions of "Lang Favlet"

From Level Access Web Labs
Jump to navigation Jump to search
Line 1: Line 1:
 
<html>
 
<html>
This Favlet uses the direct link technique and is too long to run in IE.
 
 
 
<a href="javascript:(function(){var%20element=document.createElement('script');element.setAttribute('src','lang.js');document.body.appendChild(element);})();"> lang attributes Favlet </a>
 
<a href="javascript:(function(){var%20element=document.createElement('script');element.setAttribute('src','lang.js');document.body.appendChild(element);})();"> lang attributes Favlet </a>
 
</html>
 
</html>

Revision as of 02:26, 5 February 2014

lang attributes Favlet Sample code

javascript:(function(){
var el = document.querySelectorAll('[lang]');
var str;
var headers=[];
var sentinel;
if (el.length>0) {
 	for (var i=0; i<el.length; i++) {
			s = document.createElement('Span');
			t = document.createTextNode(" lang="+el.item(i).lang +" ");
			s.appendChild(t);
			s.style.backgroundColor = 'antiqueWhite';
			s.style.color = 'black';
			el.item(i).insertBefore(s,el.item(i).firstChild);
	}
}
else {
	  alert('no language set');
}

})();