显示确认文本框使用JavaScript入境后 [英] Show confirmation textbox after entry with JavaScript

查看:137
本文介绍了显示确认文本框使用JavaScript入境后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们开始之前,我想传达,我仅限于JavaScript语言毫不知情。我使用的唯一的东西是jQueryUI的 - 甚至是复制粘贴

目前,我有一个用户注册页面,所有的标准文本框输入。我想,但是,滑下一个次要确认电子邮件和确认密码只要用户输入文本到原始文本框。

我了解社会喜欢帮助那些谁可以证明他们帮助自己,但是我现在必须展示的唯一的事情就是我的尝试的查找,这和失败的解决方案。

可能有人请告诉我一个办法做到这一点?

编辑:密码箱code

 < D​​IV CLASS =ctrlHolder>
    < ASP:标签ID =Label9=服务器FONT-粗体=真文本=密码>< / ASP:标签>
    < ASP:标签ID =Label11=服务器的CssClass =styleLabelWatermarkWashout文本​​=**********>< / ASP:标签>
    < BR />
    <% - 数据默认值=占位符文本 - %GT;
    < ASP:文本框ID =txtRegisterPassword=服务器的CssClass =为textInput styleTextBoxCenter需要
        的TextMode =密码MAXLENGTH =20>< / ASP:文本框>
< / DIV>


解决方案

我想引用将jQuery添加到您正在使用的页面。
然后,让一个新的脚本(在页面上或在一个单独的的.js 文件),它附加一个新的功能,为文本框的onkeyup事件。事情是这样的。

  $(文件)。就绪(函数()
{
    $('mytextbox')。绑定(KEYUP',函数(){
        $('myCOnfirmationTextbox')了slideDown()。
    };
});

此将这个功能附加到对应于mytextbox级或ID的所有元素。所以,如果你有一个输入<输入类型=文本ID =电子邮件级=emailInput/> 那么你可以使用 $('#电子邮件')事件绑定到这个特殊的元素。您也可以使用 $('。Emailinput')绑定到的电子邮件所有输入元素。

顺便说一句,我还没有测试code,但是这还是非常类似的东西应该工作。

如果你使用一个单独的的.js 文件,那么不要忘记引用它在你的网页也是如此。

Before we begin, I would like to convey that I have limited to no knowledge on the JavaScript language. The only things I've used is JQueryUI - and even that is copy paste.

Currently, I have a user registration page, with all the standard TextBox inputs. I would like to, however, slide down a secondary 'Confirm email' and 'confirm password' whenever a user enters text into the original text box.

I understand the community likes to help those who can prove they helped themselves, but the only thing I currently have to show is me trying to lookup solutions for this and failing.

Could someone please show me a way to do this?

Edit: Code of the password box

<div class="ctrlHolder">
    <asp:Label ID="Label9" runat="server" Font-Bold="True" Text="Password"></asp:Label>
    <asp:Label ID="Label11" runat="server" CssClass="styleLabelWatermarkWashout" Text="**********"></asp:Label>
    <br />
    <%--data-default-value="Placeholder text"--%>
    <asp:TextBox ID="txtRegisterPassword" runat="server" CssClass="textInput styleTextBoxCenter required"
        TextMode="Password" MaxLength="20"></asp:TextBox>
</div>

解决方案

I would add a reference to jquery to the page you are working on. Then make a new script (on the page or in a separate .js file) which attaches a new function to the onkeyup event for the textboxes. Something like this.

$(document).ready(function()
{
    $('mytextbox').bind('keyup', function() { 
        $('myCOnfirmationTextbox').slideDown();
    };
});

This will attach this function to all elements corresponding to the "mytextbox" class or ID. So if you have an input <input type="text" id="email" class="emailInput"/> then you would use $('#email') to bind the event to this particular element. Or you use $('.Emailinput') to bind to all input elements for emails.

By the way, I haven't tested the code, but this or something very similar should work.

If you use a separate .js file, then don't forget to reference it in your page as well.

这篇关于显示确认文本框使用JavaScript入境后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆