This example has been tested using MSIE 5.0
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
Using a $$SearchTemplateDefault, place the $$ViewBody field positioned a bit down the page. Below this as HTML include the following:
<DIV style="top:100; left:50; position: absolute; ">
<script>document.write('Your search returned ')</script>
<script>document.write((document.links.length - 3))</script>
<script>document.write(' documents. ')</script></DIV>
The <DIV> tag positions the text "Your search returned x documents." ABOVE the documents returned (which is more readable if a long list of documents is returned). The actual code needs to be below the $$ViewBody so as to be able to count all of the documents (as links).
In this example, I have three hyperlinks used for navigation on the page. By subtracting 3 from the document.links.length value, I return the correct number of documents.
We can also enhance the text by using the QUERY_STRING to display the searched-for text or use an "if" statement to display "document" instead of "documents" if only one document is returned.
The <div> tag is also useful for positioning elements (such as graphics) flush with the left/top instead of using the HTMLHead to set margin values for the entire page which can cause headaches for text display.