Modify all elements with a specific attribute

The code example below was used on a default Domino calendar view template form. It removes the HREF values for the automatically generated links for each day (which annoyingly opens to a dual day view). Just call the function below in the onLoad event. Domino adds a target="_self" to all these links, so you can filter by them.
JavaScript • Lotus Notes Form • Lotus Notes View


function removealldatelinks() {
	var anchors, target;
	var anchors = document.getElementsByTagName('a');
	for(var a=0;a<anchors.length;a++) {
		target = anchors[a].getAttribute('target');
		if (target=='_self') {
			anchors[a].setAttribute('href','javascript:void();');
		}
	}
}

Posted by fbrefere001 on Friday March 21, 2014