There is no standards-compliant method to do this that will work across all browsers. I wouldn't be surprised if there were an IE-only way to do this in that browser, but I wouldn't know. If this is the route that you wish to take, perhaps the
HTML/Javascript forum would be a good place to further pursue this.
But I'd say that a better way to do this would be for your button to post a request to a
servlet that would set the content type of the response to text and specify it as an 'attachment' (search these forums for this term for exact syntax examples) and then outputs the data in whatever text-only format is approriate.
This should cause the download dialog of the browser to open to allow the user to save the text file to disk.
hth,
bear