Tag: 用户input

如何使数字input区最初为空而不是0或0.00?

我有一个input的地方,应该得到一个数字。 我希望它显示为空。 但是,当我运行我的程序,我得到0或0.00作为默认值。 我怎样才能把它弄空?

将两个h:inputText字段分割为小时和分钟,并使用f:convertDateTime分割java.util.Date

我想在这个页面中设置一个Date字段 |hours| h |minutes| 小时和分钟在分开的inputText中。 豆有这个date import java.util.Date; … private Date myDate; … 和页面是 <h:form> … <h:inputText id="myDateHours" maxlength="2" value="#{myBean.myDate}" <f:convertDateTime pattern="HH" /> </h:inputText> <h:outputText value=" h " /> <h:inputText id="myDateMinutes" maxlength="2" value="#{myBean.myDate}" <f:convertDateTime pattern="mm" /> </h:inputText> … </h:form> 但问题是,当我提交表单只有最后一个元素被保存。 例如,如果我input小时数,然后input分钟数,则小时数将被覆盖,结果是 | 00 | h | minutes | 我试图设置 <h:inputText id="myDateHours" value="#{myBean.myDate.hours}></h:inputText> <h:inputText id="myDateMinutes" value="#{myBean.myDate.minutes}></h:inputText> […]

如何查看哪个checkbox被选中?

如何在PHP中检查checkbox是否被选中?

我如何使用cout << myclass

myclass是我写的C ++类,当我写: myclass x; cout << x; 如何输出10或20.2 ,如integer或float值?

如何删除batch file中用户提供的input的尾随和前导空格?

我知道如何做到这一点,当variables是预先定义的。 但是,当要求用户input某种input时,如何修剪首尾空白? 这是我迄今为止: @echo off set /p input=: echo. The input is %input% before ::trim left whitespace for /f "tokens=* delims= " %%a in ("%input%") do set input=%%a ::trim right whitespace (up to 100 spaces at the end) for /l %%a in (1,1,100) do if "!input:~-1!"==" " set input=!input:~0,-1! echo. The input is %input% after […]

为什么types为“number”的htmlinput允许在字段中input字母“e”?

我有以下html5input元素: <input type="number"> 为什么此input允许在input字段中input字符“e”? 没有其他字母字符可以input(如预期) 使用chrome v。44.0.2403.107 看看我的意思: http : //www.w3schools.com/html/tryit.asp ?filename= tryhtml_input_number

如何获得使用jQuery的inputtypes?

我有一个页面,inputtypes总是变化,我需要取决于inputtypes的值。 所以,如果types是一个无线电,我需要得到哪个检查,如果它是一个checkbox,我现在需要检查,如果是一个下拉菜单,我需要知道哪个select,如果它是一个文本/ textarea我需要知道的价值观。 任何想法如何做到这一点?

当TextBox具有焦点时,UserControl中的KeyBinding不起作用

以下情况。 我有一个用五个键绑定的用户控件。 当TextBox具有焦点时,UserControl的键绑定停止点燃。 有没有办法解决这个“问题”? <UserControl.InputBindings> <KeyBinding Key="PageDown" Modifiers="Control" Command="{Binding NextCommand}"></KeyBinding> <KeyBinding Key="PageUp" Modifiers="Control" Command="{Binding PreviousCommand}"></KeyBinding> <KeyBinding Key="End" Modifiers="Control" Command="{Binding LastCommand}"></KeyBinding> <KeyBinding Key="Home" Modifiers="Control" Command="{Binding FirstCommand}"></KeyBinding> <KeyBinding Key="F" Modifiers="Control" Command="{Binding SetFocusCommand}"></KeyBinding> </UserControl.InputBindings> <TextBox Text="{Binding FilterText, UpdateSourceTrigger=PropertyChanged}"> <TextBox.InputBindings> <KeyBinding Gesture="Enter" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl }}, Path=DataContext.FilterCommand}"></KeyBinding> </TextBox.InputBindings> </TextBox> 看来function键( F1等)和ALT + [键]工作。 我认为CTRL和SHIFT修饰符以某种方式阻止事件冒泡到UserControl。

如何识别java中InputStream的结尾

我想从服务器读取字节使用Socket程序,即我使用InputStream来读取字节。 如果我通过长度大小,我可以读取字节,但我不知道可能是什么长度。 所以我不能初始化字节数组。 我也试过while (in.read() != -1) ,我观察到它循环工作正常,当数据发送,但循环后的下一行是不可执行的,我觉得它仍然在寻找stream中的数据但没有数据。 如果我closures服务器连接,那么我的客户端将执行循环的下一行。 我不确定我哪里错了? this.in = socket.getInputStream(); int dataInt = this.in.read(); while(dataInt != -1){ System.out.print(","+i+"–"+dataInt); i++; dataInt = this.in.read(); } System.out.print("End Of loop"); 我得到的输出为: – ,1–0,2–62,3–96,4–131,5–142,6–1,7–133,8–2,9–16,10–48,11–56,12–1,13–0,14–14,15–128,16–0,17–0,18–0,19–48,20–0,21–0,22–0,23–0,24–0,25–1,26–0,27–0,28–38,29–114,30–23,31–20,32–70,33–3,34–20,35–1,36–133,37–48,38–51,39–49,40–52,41–49,42–55,43–49,44–52,45–52,46–54,47–55,48–50,49–51,50–52,51–48,52–53,53–56,54–51,55–48,56–48,57–57,58–57,59–57,60–57,61–57,62–57,63–57,64–56 但是没有输出: – End Of loop 请指导我如何closures循环? 期待您的回应。 提前感谢你们。

使用Javascript函数设置input的值

我目前正在使用YUI小工具。 我也有一个Javascript函数来validation来自YUI的div的输出: Event.on("addGadgetUrl", "click", function(){ /* line x ——>*/ var url = Dom.get("gadget_url").value; if (url == "") { error.innerHTML = "<p> error" /></p>"; } else { /* line y —> */ /* I need to add some code in here to set the value of "gadget_url" by "" */ } }, null, true); 这是我的div : […]