I'm almost embarrassed to put this up because it's so small, but it's something I used to do all the time and had reason to have to re-learn it recently for something I was doing.
Sometimes -- at least until I find a better way -- I need to be able to get "editable" debugging text out of javascript. Using the "alert" box doesn't work for this because you can't do the ctrl-c trick to get its text. (For some message boxes, you can hit ctrl-c and it'll copy the contents such that you can put it into notepad.)
Anyway, the javascript below will cause a new window to open and will write whatever you want into it. Then you can do whatever you would normally do with what shows up in IE windows. FYI, the contents of the open() method is a double-apostrophe for a required parameter that nevertheless can be empty.
window.open('').document.write('your text here')
Print
posted @ Tuesday, April 01, 2008 12:45 PM