Odd behavior in window.prompt()

I’ve got a script which calls window.prompt(). I’m testing it (and will use it) in a Node.js server under Windows 7.

There are a couple of weird things about the dialog that the function opens. First, the title bar is blank. That’s sort of understandable, since I didn’t put anything in it, but since the function has only two parameters – prompt text and default response – I don’t see how I can put anything in it. Is there a way? Or is a dialog displayed by window.prompt() untitled, always and forever?

The second weird thing is that the dialog box opens with the focus on the OK button. I can’t type into the text box without clicking it first. This is a lot more serious; the whole point of the code I’m writing is to make a frequent operation efficient, and this multiplies the effort needed to perform it by a factor of perhaps three. How do I make prompt() accept text without moving the focus first?

Hi Orthoducks,

Node.js doesn’t have a window object as it’s an object provided by the browser to client-side JS. As far as I know, Node doesn’t have any way of generating GUI dialogs… you can take user input from the command line or set up a server to listen on a TCP port.