At the risk of being slated for giving you too much code... given that your question hasn't been tagged jQuery
a pure Javascript implementation could be as follows:
(function(){
var loader = window.onload;
window.onload = function(){
if(typeof loader == 'function') loader();
var els = document.getElementsByTagName('input'), data = [];
for(var i=0;i<els.length;i++){
var type = els[i].getAttribute('data-type') || 'unknown';
if(typeof data[type] == 'undefined') data[type] = 1;
else data[type]++;
}
var out = '';
for(var key in data){
if(out != '') out += 'and '; else out += 'You have ';
out += data[key] + ' ' + key + ' data-type ';
}
alert(out);
}
})();
Somewhat more convoluted and perhaps confusing - but should you post any further questions please include code examples of what you have tried and state where exactly you are fuzzy.