prompt

JavaScript Prompt Box Cancel Button?

空扰寡人 提交于 2019-11-30 04:37:30
问题 I have a JavaScript function as follows: function popup(username) { var req = createAjaxObject(); var message = prompt("Message:",""); if(message != ""){ req.onreadystatechange = function() { if (req.readyState == 4) { alert(req.responseText); } } req.open('POST','getmessage.php',true); req.setRequestHeader("Content-type","application/x-www-form-urlencoded"); req.send("username=" + username +"&message="+message); } else { alert("Please enter a message"); } } When the Cancel button is hit, the

UINavigationItem Prompt Issue

偶尔善良 提交于 2019-11-30 04:03:27
问题 I'm having a problem with the prompt on a UINavigationItem that I just can't resolve... I have a master and a detail view controller. When I push from the master to the detail a prompt is shown on the detail view controller: However, when I pop back to the master view controller, the view isn't resized and the window shows through (the window has been coloured red): This only happens on iOS7, on iOS6 the view resizes as expected. I've tried a few things such as setting the prompt to nil in

Detect empty value on prompt

心不动则不痛 提交于 2019-11-30 03:20:32
问题 How to detect an empty value when user presses ok on prompt (and previously empties the prompt field)? I need to overwrite the old value with the new (empty) value. I'm doing this: var oldVal = 'something'; var newVal = prompt("Enter new value:", oldVal); Currently it returns null if user empties value and clicks ok. But at the same time I need to check for null value because if user clicks 'cancel', it will return null, which I don't want as new value. 回答1: It does not return null if the

Constantly updated clock in zsh prompt?

大兔子大兔子 提交于 2019-11-30 00:55:14
I know that I can exec a date command in my zsh prompt. However, it shows the old time; to see the current time, I have to hit <return> and get a new prompt with the current time. Is there a way to configure the zsh prompt to constantly update itself every second? This would be .... unpleasant in a standard zsh prompt (or bash, or other shells). I suggest you'd be better off using Gnu Screen. Screen can have a status line which can show the time. Here's an example screenrc scroll down to "Red Hat Magazine A guide to GNU Screen" to see the sample (i'll reproduce that here) which will, when

How can I shorten the path of a DOS prompt?

对着背影说爱祢 提交于 2019-11-29 22:52:51
My path on my DOS prompt is ridiculously long. How can I shorten this? C:\RUBY\Ruby_Practice\prep-work-master\coding-test-2\practice-problems\spec> Jiminion Right-click on My Computer|Properties. Then from the Advanced Tab, click Environment Variables, then add a new User Variable called PROMPT and set it to $p$_$+$g . http://www.hanselman.com/blog/ABetterPROMPTForCMDEXEOrCoolPromptEnvironmentVariablesAndANiceTransparentMultiprompt.aspx To remove the path from the prompt use 'prompt $g' which will just show the chevron. You can then use the 'cd' command anytime to see the directory you are in.

How to change command-line prompt in Windows?

依然范特西╮ 提交于 2019-11-29 20:16:29
How to change the command-line prompt into a console? I've been looking in the console functions API but I could not find anything for it. There's the PROMPT environment variable: set PROMPT=$P$G is the default value, giving you the usual C:\> type output. There's more format variables available here . Another possibility is to set PROMPT environment variable (what's in fact what the prompt command is doing). The advantage of this method is that you can easily set it system-wide and you don't need any scripts, edit registry etc. It will work for any console window no matter how you open it.

How can I change the color of my prompt in zsh (different from normal text)?

China☆狼群 提交于 2019-11-29 18:56:18
To recognize better the start and the end of output on a commandline, I want to change the color of my prompt, so that it is visibly different from the programs output. As I use zsh, can anyone give me a hint? Here's an example of how to set a red prompt: PS1=$'\e[0;31m$ \e[0m' The magic is the \e[0;31m (turn on red foreground) and \e[0m (turn off character attributes). These are called escape sequences. Different escape sequences give you different results, from absolute cursor positioning, to color, to being able to change the title bar of your window, and so on. For more on escape sequences

Different bash prompt for different vi editing mode?

混江龙づ霸主 提交于 2019-11-29 18:47:54
When using vi mode (set -o vi) with Bash, it would be nice to have a prompt that depends on the mode you are currently in (insert or command). How does one find out this editing mode? B.t.w, this seems to be possible in ZSH : Fresh bash 4.3 and readline 6.3 have something for you guys.. from the changelog: 4. New Features in Readline j. New user-settable variable, show-mode-in-prompt, adds a characters to the beginning of the prompt indicating the current editing mode. So putting set show-mode-in-prompt on into /etc/inputrc or ~/.inputrc (thx stooj) should affect all your readline-enabled

Close Prompt alert box automatically with 10Seconds in XUL JavaScript

你。 提交于 2019-11-29 16:29:17
This is my prompt alert box function in XUL: function promptBoxes() { var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var check = {value: false}; // default the checkbox to false var flags = prompts.BUTTON_POS_0 * prompts.BUTTON_TITLE_Ok+ prompts.BUTTON_POS_1 * prompts.BUTTON_TITLE_IS_STRING; var button = prompts.confirmEx(null, "Title of this Dialog", "What do you want to do?", flags, "", "Cancel", "", null, check); // 0, 1, or 2. } I have taken the above function from this website: https://developer.mozilla.org

if statement in javascript always true

橙三吉。 提交于 2019-11-29 13:54:32
So, I have the code, its not done, but all i want it to do is display one alert box if I write the word 'help', and say something else if anything else is entered. function prompter() { var reply = prompt("This script is made to help you learn about new bands, to view more info, type help, otherwise, just click OK") if (reply === 'help' || 'Help') { alert("This script helps you find new bands. It was originally written in Python 3.0.1, using Komodo IDE, but was then manually translated into Javascript. Please answer the questions honestly. If you have no opinion on a question, merely press OK