jQuery的互动线索错误状态风格互动、线索、状态、风格

2023-09-06 05:04:03 作者:那被允许任性旳年华

我试图使用jQuery的CSS框架样式的必填字段错误。当表单提交的文本框中没有价值,应该prevent形式的提交,并应显示与下面的风格。

•UI辅助复位

•UI辅助-clearfix

•UI态错误文本

•UI图标警戒

什么是做到这一点的最好方法是什么?

注:code对应于ASP.NET(的形式=服务器

在code:

 < HTML LANG =EN>

< HEAD>

<脚本类型=文/ JavaScript的SRC =htt​​p://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js>< / SCRIPT>
<脚本类型=文/ JavaScript的SRC =htt​​p://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.6/jquery-ui.js>< / SCRIPT>
<链接HREF =htt​​p://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.13/themes/flick/jquery-ui.css
    相对=样式类型=文本/ CSS/>
<冠军>互动线索< /标题>
< /头>

<身体GT;
    <% -  UI辅助复位,UI辅助-clearfix,UI状态错误文本,UI图标警戒 - %>
    <形式=服务器>

        < D​​IV>
            &其中a取代;用户名< / A>
            <输入ID =文本1型=文本/>
            <跨度> *< / SPAN>
            < A>必填字段< / A>
        < / DIV>

    <输入ID =Button1的类型=按钮值=按钮/>
    < /形式GT;
< /身体GT;

< / HTML>
 

解决方案 的onclick添加事件上的按钮, 在功能的onclick把所有你想要的验证 如果成功__d​​oPostBack('',''); 如果没有显示信息或某事

I am trying to use jQuery CSS Framework for styling the required field error. When the form is submitted with no value in the text box, it should prevent the form from submitting and should display the style corresponding to the following.

9 款风格华丽的 jQuery CSS3 插件推荐

• ui-helper-reset

• ui-helper-clearfix

• ui-state-error-text

• ui-icon-alert

What is the best way to do this?

Note: The code is corresponding to ASP.NET (form runat="server")

The CODE:

<html lang="en">

<head>

<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js"></script>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.6/jquery-ui.js"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.13/themes/flick/jquery-ui.css"
    rel="stylesheet" type="text/css" />
<title>Interaction cues</title>
</head>

<body>
    <%-- ui-helper-reset, ui-helper-clearfix, ui-state-error-text,  ui-icon-alert--%>
    <form runat="server" >

        <div> 
            <a> User Name </a>
            <input id="Text1" type="text" />
            <span> * </span>
            <a>Required field</a> 
        </div>

    <input id="Button1" type="button" value="button" />
    </form>
</body>

</html>

解决方案

add the event onclick on the button, on the function onclick put all the validation you want if success __doPostBack('',''); if failed display message or something