Tag: 用户input

JavaScript:检查鼠标是否按下?

有没有一种方法来检测是否在JavaScript中的鼠标button当前closures? 我知道“mousedown”事件,但这不是我所需要的。 按下鼠标键一段时间后,我希望能够检测是否仍然按下。 这可能吗?

如何获得一个<input type =“number”>字段的原始值?

我怎样才能得到一个<input type="number">字段的“真实”值? 我有一个input框,我使用了更新的HTML5inputtypesnumber : <input id="edQuantity" type="number"> Chrome 29主要支持这个function: 我现在需要的是能够读取用户在input框中input的“原始”值。 如果用户input了一个数字: 那么edQuantity.value = 4 ,一切都很好。 但是,如果用户input无效的文本,我想为红色的input框着色: 不幸的是,对于type="number"input框,如果文本框中的值不是数字,那么value将返回一个空string: edQuantity.value = "" (String); (至less在Chrome 29中) 如何获得<input type="number">控件的“原始”值? 我试图通过铬的input框的其他属性的列表: 我没有看到类似于实际input的任何内容。 我也不能find一个方法来判断这个盒子是否是空的 。 也许我可以推断: value isEmpty Conclusion ============= ============= ================ "4" false valid number "" true empty box; not a problem "" false invalid text; color it red 注意 […]

获取用户input

我正在运行这个: import csv import sys reader = csv.reader(open(sys.argv[0], "rb")) for row in reader: print row 我得到这个回应: ['import csv'] ['import sys'] ['reader = csv.reader(open(sys.argv[0]', ' "rb"))'] ['for row in reader:'] [' print row'] >>> 对于sys.argv[0]我希望它提示我input一个文件名。 我如何得到它来提示我input文件名?

如何设置默认值到input

我努力了 <input type="date" value="2013-1-8"> 像这样: demo 但是我失败了,我怎么设置默认值呢?

如何在Angular2中检测@Input()值的变化

我有一个父组件( CategoryComponent ),一个子组件( videoListComponent )和一个ApiService。 我大部分工作正常,即每个组件可以访问JSON API,并通过observables获取其相关数据。 目前的video列表组件只是获取所有的video,我想过滤这只是一个特定类别的video,我通过@Input()将categoryId传递给孩子来实现这一点。 CategoryComponent.html <video-list *ngIf="category" [categoryId]="category.id"></video-list> 这工作,当父类CategoryComponent类别更改然后categoryId值通过@Input()传递但我需要在VideoListComponent中检测到此并通过APIService(具有新的categoryId)重新请求video数组。 在angular1中,我会在variables上做一个$watch 。 处理这个问题的最好方法是什么?

input号码隐藏微调 – Firefox 29

在Firefox 28上,我使用的是<input type="number">因为它在input字段中只显示数字键盘。 在Firefox 29中,使用数字input在字段的右侧显示旋转button,这在我的devise中看起来像垃圾。 我真的不需要button,因为无论如何,当你需要写一个6〜10位数字的东西时,它们是无用的。 是否有可能禁用CSS或jQuery的这个?

如何克隆InputStream?

我有一个InputStream传递给一个方法做一些处理。 我将在其他方法中使用相同的InputStream,但在第一次处理后,InputStream出现在方法内部。 如何克隆InputStream发送给closures他的方法? 还有另一个解决scheme? 编辑:closuresInputStream的方法是从lib的外部方法。 我没有控制closures或没有。 private String getContent(HttpURLConnection con) { InputStream content = null; String charset = ""; try { content = con.getInputStream(); CloseShieldInputStream csContent = new CloseShieldInputStream(content); charset = getCharset(csContent); return IOUtils.toString(content,charset); } catch (Exception e) { System.out.println("Error downloading page: " + e); return null; } } private String getCharset(InputStream content) { try […]

jquery如何清空input字段

我在一个移动应用程序,我使用一个input字段,以便用户提交一个数字。 当我返回到input栏显示在input栏中显示的最新数字input的页面时。 每次页面加载时有没有办法清除字段? $('#shares').keyup(function(){ payment = 0; calcTotal(); gtotal = ($('#shares').val() * 1) + payment; gtotal = gtotal.toFixed(2); $("p.total").html("Total Payment: <strong>" + gtotal + "</strong>"); });

密码屏蔽控制台应用程序

我尝试了下面的代码… string pass = ""; Console.Write("Enter your password: "); ConsoleKeyInfo key; do { key = Console.ReadKey(true); // Backspace Should Not Work if (key.Key != ConsoleKey.Backspace) { pass += key.KeyChar; Console.Write("*"); } else { Console.Write("\b"); } } // Stops Receving Keys Once Enter is Pressed while (key.Key != ConsoleKey.Enter); Console.WriteLine(); Console.WriteLine("The Password You entered is : […]

为什么不是textarea的input?

为什么有一个元素<textarea>而不是<input type="textarea"> ?