Code:
<script type="text/javascript"> 
<!-- 
window.onload=function(){
alert("script is running"); 
document.getElementById('form1:SearchResultTable:0:formPdfLink').onclick=function(){this.style.color= '#CC0000'; 
return false;} 
} 
//--> 
</script>
I put this into my search results JSP page. The links are dynamically and IDed in this fashion (according to table location):

Code:
form1:SearchResultTable:0:formPdfLink
form1:SearchResultTable:1:formPdfLink
form1:SearchResultTable:2:formPdfLink
form1:SearchResultTable:3:formPdfLink
etc etc
Below is the code that prints the links in the jsp file
Code:
<hx:outputLinkEx styleClass="outputLinkEx" id="formPdfLink"
onclick="return openPDFWord(this, '#{varsearchResults.targetURLForPDF}');" 
value="#{varsearchResults.pdfURL}">
<h:outputText styleClass="outputText" id="text7"
value="#{varsearchResults.formIdAndEditionDate}" escape="false"></h:outputText>
</hx:outputLinkEx>
My problems:

1.)I would like to make the script an onclick function but whenever I try it doesnt run the openPdfWord function.

2.)The engine returns pages of results. If we go to the second page and come back the styling is gone. Is there a way to write a boolean method and have the jsp check if it was visited before printing?