Forum Moderators: open
looking for some help.
would like to have users view "keywords" from alphabetical list.
for example, instead of seing an alphabetical list 300 words long. I would like them to click on the linked letter "A" and have all keywords starting with the letter A returned.
first off, a little bg to help.
top of the page, I call master keyword list
===========
<%
library('global.np');
catalogName = Request.getParameter('searchCatalog');
if (catalogName.length == 0)
catalogName = CatalogSet.getAliases()[0];
fieldList = CatalogSet.get(catalogName).getTypeAll();
masterKeywordList = CatalogSet.getMasterKeywordsAll();
// Truncate the master keyword list if it is too long
masterKewordCount = masterKeywordList.length;
if (masterKeywordList.length > 128)
masterKeywordList = masterKeywordList.slice(0, 128);
%>
==========
further down the page i call the entire contents of the master keyword list for that page
==========
<% if (masterKeywordList.length > 0) { %>
<% processArray(masterKeywordList, %>
<A HREF="/netpub/server.np?quickfind=<%= masterKeywordList[x] %>&catalog=<%= catalogName %>&site=<%= encodeURI(Request.getParameter('site')) %>&template=results.np">
<%= masterKeywordList[x] %></A>
<BR>
<% ); %>
<% } %>
=========
i sure do hope this provides some info for you to work on. i will check back tonight to see any comments. Thank you so much!
-tink
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Lorem ipsum dolor sit amet</title>
<script>
function populateselect(){
pickedOptions=document.getElementById('popdata').innerHTML.split(" ");
pickedOptions=pickedOptions.sort()
for (i=0;i<pickedOptions.length;i++){
newoption=document.createElement('option')
newoption.innerText=pickedOptions[i]
document.getElementById('alpha').appendChild(newoption)
}
}
function startingwith(){
document.getElementById('alpha').options.length=0
pickedOptions=document.getElementById('popdata').innerHTML.split(" ");
pickedOptions=pickedOptions.sort()
for (i=0;i<pickedOptions.length;i++){
var firstletter=document.getElementById('sortindex').value
if(firstletter==''){alert('indicate first letter!');
return false;
}
if (pickedOptions[i].substr(0,1)==firstletter){
newoption=document.createElement('option')
newoption.innerText=pickedOptions[i]
document.getElementById('alpha').appendChild(newoption)
}
}
}
</script>
</head>
<body onload="populateselect()">
<div id="popdata" style="display:none;">a aa abcd ezraz eraze tt ptpdppf pept lkj li lnnn lnlghllhg d f dfdf ffds sdfsd qdfqs qdq f qsdf s df sd
</div>
<select id="alpha">
<select/>
</select>
<input type="text" id="sortindex" MaxLength=1 />
<input type="button" onclick="startingwith()" />
</body>
</html>