标签: input

JavaScript:显示保留的密码

我有 2 个密码输入。每个输入字段都有“显示”按钮,在按住该按钮时显示密码。

<form name="resetting_form" method="post" action="">
    <div class="form-group has-feedback">
        <input type="password" id="password_first" required="required" placeholder="New Password" class="form-control">
        <span class="show">show</span>
    </div>
    <div class="form-group has-feedback">
        <input type="password" id="password_second" required="required" placeholder="Repeat Password" class="form-control">
        <span class="show">show</span>
    </div>  
    <input type="submit" class="btn btn-primary" value="Submit">
</form>
Run Code Online (Sandbox Code Playgroud)

这是我所拥有的

$(".form-control").on("keyup",function(){
    if ($(this).val())
        $(".show").show();
    else
        $(".show").hide();
});

$(".show").mousedown(function(){
    $(".form-control").attr('type','text');
}).mouseup(function(){
    $(".form-control").attr('type','password');
}).mouseout(function(){
    $(".form-control").attr('type','password');
});
Run Code Online (Sandbox Code Playgroud)

问题

当我单击“显示”按钮时,会显示两个输入字段。如何确保只显示相应的密码?

html javascript jquery input

0
推荐指数
1
解决办法
2508
查看次数

如何在没有协议的情况下对输入类型 url 使用 jQuery 验证?

在我的输入字段验证中,我将输入类型设置为“url”。

具有“http://”或“https://”协议的 URL 是有效的。没有它,网址无效。

有效:http : //www.foo.com

有效:https : //www.foo.com

无效:www.foo.com

无效:foo.com

在我的代码中,每当 URL 链接没有“http://”或“https://”时,函数“checkURL()”就会像下面的代码一样添加它。

// just for the demos, avoids form submit
jQuery.validator.setDefaults({
  debug: true,
  success: "valid"
});
$( "#myform" ).validate({
  rules: {
    field: {
      required: true,
      url: true
    }
  }
});

function checkURL(url) {
    var string = url.value;
    
    if (!~string.indexOf("http")) {
        string = "http://" + string;
    }
    
    url.value = string;
    return url;
}
Run Code Online (Sandbox Code Playgroud)
<form id="myform">
	<label for="field">Required, URL: </label><br>
	<input type="url" id="field" name="field" onblur="checkURL(this)">
</form>

<script …
Run Code Online (Sandbox Code Playgroud)

validation url jquery http input

0
推荐指数
1
解决办法
3643
查看次数

Python 输入验证:如何将用户输入限制为特定范围的整数?

初学者在这里,寻找有关输入验证的信息。

我希望用户输入两个值,一个必须是大于零的整数,下一个是 1-10 之间的整数。我已经看到很多输入验证函数对于这两个简单的情况似乎过于复杂,有人可以帮忙吗?

对于第一个数字(大于 0 的整数,我有):

while True:
    try:
        number1 = int(input('Number1: '))
    except ValueError:
        print("Not an integer! Please enter an integer.")
        continue
    else:
        break
Run Code Online (Sandbox Code Playgroud)

这也不会检查它是否为阳性,我希望它这样做。我还没有为第二个准备任何东西。任何帮助表示赞赏!

python validation exception-handling exception input

0
推荐指数
1
解决办法
3万
查看次数

Tensorflow 中占位符的形状

我在短时间内使用 Tensorflow。这是我的问题:我加载 AlexNet 权重以对其进行微调,所以我给出了 50 的批次。所以我定义了:

# Graph input
x = tf.placeholder(tf.float32, [50, 227, 227, 3])
y = tf.placeholder(tf.float32, [None, 40])
Run Code Online (Sandbox Code Playgroud)

我给出了一批 50 张图像,并希望获得 40 个输出类。

然后我定义了我的模型

class Model:
@staticmethod 
def alexnet(_X, _dropout):
    # Layer 1 (conv-relu-pool-lrn)
    conv1 = conv(_X, 11, 11, 96, 4, 4, padding='VALID', name='conv1')
    conv1 = max_pool(conv1, 3, 3, 2, 2, padding='VALID', name='pool1')
    norm1 = lrn(conv1, 2, 2e-05, 0.75, name='norm1')
    # Layer 2 (conv-relu-pool-lrn)
    conv2 = conv(norm1, 5, 5, 256, 1, 1, group=2, name='conv2')
    conv2 = max_pool(conv2, …
Run Code Online (Sandbox Code Playgroud)

input conv-neural-network tensorflow

0
推荐指数
1
解决办法
2万
查看次数

如何读取整数直到行尾?

我正在尝试在图表上做 bfs,给定一个邻接列表。这是一个示例输入。

1 2 3
2 4
1
2 3 4
Run Code Online (Sandbox Code Playgroud)

我知道行数,n(verices 的数量)。每行包含 0 到 n-1 个整数。

这是一次尝试,但它不起作用,因为它读取所有整数直到输入结束。

 for(i=0;i<n;i++)
{
   while(cin>>v)
   {insert(i,v);}
}
Run Code Online (Sandbox Code Playgroud)

我想分别处理每一行。在搜索中,我找到了向量和 stl 的答案。如果有人能提出更优雅的解决方案,那就太好了。

谢谢。

c++ input

0
推荐指数
1
解决办法
5862
查看次数

3.6 中 raw_input() 的替代品是什么?

e=input('what's your name?')

print('so you %s, %s, %s.' % (e,l,x))
Run Code Online (Sandbox Code Playgroud)

我想创建一个程序,我需要在其中回答我的问题,但使用 input() 只会返回[so you , , .].

input raw-input python-3.x python-3.6

0
推荐指数
1
解决办法
1万
查看次数

需要输入类型的持续时间

我需要在 html 输入中询问用户的持续时间。

铁 03h 12m 12s

有没有办法给他一个选择,比如输入类型日期?

我使用 Bootstrap 4。

谢谢

forms input twitter-bootstrap

0
推荐指数
1
解决办法
2545
查看次数

将 boost::filesystem::path 转换成字符?

我已经研究出如何将 boost 路径传递为所需的格式,但是我遇到了一些问题,无法将 path.stem 传递到 char 数组中,然后对文件名进行一些检查并采取正确的操作

需要读取文件名并检查然后操作中的下一个可用数字,我打算使用 for 循环将数字放入一个字符数组中,然后与这个单独的计数器进行比较

我如何将 path() 逐字符输入到数组中 - 或者有更好的方法!

int count(boost::filesystem::path input) {

cout << "inputzz :  " << input << endl;


char data;
wstring winput;
for (int a = 0; a < 4;){

//boost::filesystem::absolute(input).string();

//cout << input.generic_string() << endl;



(input.generic_string()) >> data;


data << (boost::filesystem::path()input.generic_string());


//a++
};
Run Code Online (Sandbox Code Playgroud)

c++ arrays boost input char

0
推荐指数
1
解决办法
3203
查看次数

如何设置输入文件文本框的样式?

如何使用css为输入文件类型设置html样式,还可以更改浏览按钮,谢谢

html css input

-1
推荐指数
1
解决办法
1万
查看次数

HTML - OnChange从输入框更新图像源URL

好的,我正在为网页设计课做最后的决定.我们只能使用HTML,CSS和JAVASCRIPT.没有AJAX或其他任何东西.

我需要一些帮助.

我有一个文本框.我希望用户能够将(图像)网址粘贴到其中,并且它会自动将页面上的图像更新为他们粘贴的图像网址.

这可能吗?

我可以在文本框中使用OnChange来更新我的图片网址吗?我在每个中放入什么?

这是我的文本框

<input id="usrimg" onChange="??(What do I put here)??" type="text"/>
Run Code Online (Sandbox Code Playgroud)

这里是我想要在文本输入中更改OnChange的图像源

        imageObj.src = "??What goes here??";
Run Code Online (Sandbox Code Playgroud)

html image input

-1
推荐指数
1
解决办法
801
查看次数