SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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?

  2. #2
    SitePoint Mentor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,267
    Mentioned
    33 Post(s)
    Tagged
    5 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •