Simple JavaScript Alphabet

Simple JavaScript Alphabet

One obvious way to display or filter large recordsets is alphabetically. This function will take a page file and an optional frame name (defaults to _self) and create a row of capital letters linked to that page with an ‘ALPHA’ QueryString parameter for positioning or filtering the records on the target page. Easy variations include checking if the target is the same page and utilizing the ‘#’ for repositioning.

This version also accommodates the use of additional QueryString parameters in the link by adding either a ‘?’ or an ‘&’ based on whether the linking page already has a ‘?’ in it.

  function CreateAlphaLink(sPage, sFrame)  {  	var i;  	var sAlpha;  		  	if(String(sFrame).toLowerCase() == "null")   		sFrame = "_self?";  		  	if (String(sPage).indexOf("?") != -1) 		sPage += "&";	 	else sPage += "?";   	for(i = 1; i ";  		sAlpha += String.fromCharCode(64+i) + " ";  		Response.Write(sAlpha);  	}  } }

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist