想要学习Javascript [英] Want to Learn Javascript

查看:81
本文介绍了想要学习Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我是ASP和JS的初学者.我用一些文本框和下拉列表完成了ASP页面的设计.它工作正常.我需要使用javascript来验证每个字段.请帮助我.

谢谢

Hi
I am beginner for asp and js.I had complet the asp page designing with some of the textbox and dropdownlist.It is working properly.I need to validate each one of the field by using javascript.Kindly any one assist me.

Thanks

推荐答案

您可以访问
http://jquery.com/ [ ^ ]
您可以了解有关jquery验证的更多信息.
you can visit
http://jquery.com/[^]
you can learn more about jquery validation.


这是针对ASP下拉列表的JavaScript验证的示例代码.脚本为:



Here is the sample code for JavaScript validation against ASP dropdownlist. Script will be:



function validateDropDown(obj){
        if(document.getElementById(obj).value=='')
        {
            alert('please select an item value under any group name.'); 
            return false;
        }
    }



在代码行为中,您必须将上述JavaScript函数附加到DropDownList控件和一个Button控件中,该控件将表单数据提交到服务器



In code behing, you have to attach the above JavaScript function with DropDownList control and a Button control that will submit the form data to the server

protected void Page_Load(object sender, EventArgs e)
{

    DropDownList1.Attributes.Add("onchange", "javascript:return validateDropDown('" + DropDownList1.ClientID + "');");

    Button1.Attributes.Add("onclick", "javascript:return validateDropDown('" + DropDownList1.ClientID + "');");
}


您可以通过以下链接阅读:

http://www.w3schools.com/js/js_whereto.asp

http://www.java2s.com/Tutorial/JavaScript/CatalogJavaScript.htm

http://www.dynamicdrive.com/
You can read by following links :

http://www.w3schools.com/js/js_whereto.asp

http://www.java2s.com/Tutorial/JavaScript/CatalogJavaScript.htm

http://www.dynamicdrive.com/


这篇关于想要学习Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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