prompt

How to redirect while prompt is still active?

自古美人都是妖i 提交于 2019-12-24 04:45:10
问题 So say I have the following code: window.prompt('Redirecting'); location.href = '/'; (I know this isn't useful code, but wait one sec) I can't figure out how to make it so that prompt doesn't 'freeze' the whole browser so that the redirect is forced to happen. So that in essence what I want is the prompt to come up and immediately for the page to redirect. (without user pressing anything) I can't seem to find any documentation on how to have a timer on prompt to stop it after a while and/or

Python函数-input()

偶尔善良 提交于 2019-12-23 20:14:50
input ( [ prompt ] ) 如果 [ prompt ] 是存在的,它被写入标准输出中没有换行。然后函数读取输入,将其转换为一个字符串,然后返回。 1 >>> s = input('--> ') 2 --> Monty Python's Flying Circus 3 >>> s 4 "Monty Python's Flying Circus" 补充: python 2.x版本的解释: 使用input和raw_input都可以读取控制台的输入,但是input和raw_input在处理数字时是有区别的 当输入为纯数字时: input返回的是数值类型,如int,float raw_inpout返回的是字符串类型,string类型 输入字符串为表达式 input会计算在字符串中的数字表达式,而raw_input不会。 如输入“57 + 3”: input会得到整数60 raw_input会得到字符串”57 + 3” python input的实现 看python input的文档,可以看到input其实是通过raw_input来实现的,原理很简单,就下面一行代码: 1 def input(prompt): 2 return (eval(raw_input(prompt))) 来源: https://www.cnblogs.com/guyuyuan/p/6917037.html

Javascript or JQuery Password Prompt

元气小坏坏 提交于 2019-12-23 19:07:31
问题 I've found similar questions on the net, but not a viable solution to them. My question, as the title suggests, is how could I leverage jQuery or Javascript to create a password prompt when, for example, a button is clicked. So the following, but instead of showing the text, I'd like the text field act as a password field. var pass1 = 'hello123'; password=prompt('Please enter password to view page') if (password==pass1) alert('password correct! Press ok to continue.') I want something similar

perl6 Is there a way to do editable prompt input?

时间秒杀一切 提交于 2019-12-23 17:29:11
问题 In bash shell, if you hit up or down arrows, the shell will show you your previous or next command that you entered, and you can edit those commands to be new shell commands. In perl6, if you do my $name = prompt("Enter name: "); it will print "Enter name: " and then ask for input; is there a way to have perl6 give you a default value and then you just edit the default to be the new value. E.g.: my $name = prompt("Your name:", "John Doe"); and it prints Your name: John Doe where the John Doe

How to prevent Google Chrome suppressing dialogs?

痞子三分冷 提交于 2019-12-23 09:17:28
问题 How can I prevent Chrome console giving the following error when I try to use the prompt() command? A window.prompt() dialog generated by this page was suppressed because this page is not the active tab of the front window. Please make sure your dialogs are triggered by user interactions to avoid this situation. https://www.chromestatus.com/feature/5637107137642496 Up until 2-3 days ago the prompt() command worked fine and would open a dialog where I could input data, now it always gives me

Shell script user prompt/input

﹥>﹥吖頭↗ 提交于 2019-12-23 08:35:55
问题 This is a crude korn shell script that someone else wrote. I don't know much about using shell syntax and I'm not even sure if this is possible. Is there any way for me to run this file and be prompted for the date so that I don't have to manually go into the script and change it each time? For example, I want to replace the "1/12/09" with a variable that is taken from a user prompt. #!/bin/ksh ./clear_old ./rooms_xls.pl 1/12/09 cd doors ./doors_xls.pl 1/12/09 回答1: If you want to be prompted

Node.js synchronous prompt

眉间皱痕 提交于 2019-12-23 07:57:39
问题 I'm using the prompt library for Node.js and I have this code: var fs = require('fs'), prompt = require('prompt'), toCreate = toCreate.toLowerCase(), stats = fs.lstatSync('./' + toCreate); if(stats.isDirectory()){ prompt.start(); var property = { name: 'yesno', message: 'Directory esistente vuoi continuare lo stesso? (y/n)', validator: /y[es]*|n[o]?/, warning: 'Must respond yes or no', default: 'no' }; prompt.get(property, function(err, result) { if(result === 'no'){ console.log('Annullato!')

Windows Git bash prompt not displaying colours from a function

狂风中的少年 提交于 2019-12-23 03:25:20
问题 I'm using the following colour codes/function (pinched from Paul Irish) in my .bash_prompt, to display branch name and status in Git bash on windows. MAGENTA="\033[1;31m" ORANGE="\033[1;33m" GREEN="\033[1;32m" PURPLE="\033[1;35m" WHITE="\033[1;37m" BOLD="" RESET="\033[m" function git_info() { # check if we're in a git repo git rev-parse --is-inside-work-tree &>/dev/null || return # quickest check for what branch we're on branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||') # check

Interaction between Python script and linux shell

这一生的挚爱 提交于 2019-12-22 08:18:15
问题 I have a Python script that needs to interact with the user via the command line, while logging whatever is output. I currently have this: # lots of code popen = subprocess.Popen( args, shell=True, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stdout, executable='/bin/bash') popen.communicate() # more code This executes a shell command (e.g. adduser newuser02) just as it would when typing it into a terminal, including interactive behavior. This is good. Now, I want to log, from within the

Prompt dialog in WSH using JScript?

时光怂恿深爱的人放手 提交于 2019-12-22 03:09:53
问题 How to open a prompt dialog box in WSH usig JScript?? The only pop-up dialog I've found in the doc is the WshShell.Popup() method. But I need a way to request the user to enter a string, like the window.prompt() method in DOM. Thanks. 回答1: I think the WScript object does not provide such a method however you can show an input box from vbscript running on WSH. So here is one possible solution which lets you call that VB function from within JS! Please note the file extension for the following