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 <= 26; i++)  	{  		sAlpha = "";  		sAlpha += String.fromCharCode(64+i) + " ";  		Response.Write(sAlpha);  	}  } }
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: