Difference between revisions of "Title Attribute Favlet"

From Level Access Web Labs
Jump to navigation Jump to search
Line 2: Line 2:
<a href=”javascript:(function(){var%20element=document.createElement(‘script’);element.setAttribute(‘src’,'Title_attribute.js’);document.body.appendChild(element);})();”> Title Attribute Favlet </a>
<a href=”javascript:(function(){var%20element=document.createElement(‘script’);element.setAttribute(‘src’,'title_attribute.js’);document.body.appendChild(element);})();”> Title Attribute Favlet </a>

Revision as of 03:31, 5 February 2014

This Favlet displays the text of all title attributes.

Title Attribute Favlet

Sample code

var el = document.querySelectorAll('[title]');
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(" Title="+el.item(i).title +" ");
			s.style.backgroundColor = 'antiqueWhite';
			s.style.color = 'black';
else {
	  alert('no elements with titles');