Thanks Jhieminga. I should have been more specific - initially I wanted a search box to find text in a particular html doc and then if that worked add boxes in other items on my website.
I tried the Google code you suggested - the box appeared OK on the web page but returned 'No results' for any of the words I entered even though they featured in the text. Also lots of non-relevant links to ads appeared.