我有一个 jQuery,它创建一个提示框以获取*形式的密码。这是我的代码:
$(function () {
password = $("#password"),
allFields = $([]).add(password),
tips = $(".validateTips");
function updateTips(t) {
tips
.text(t)
.addClass("ui-state-highlight");
setTimeout(function () {
tips.removeClass("ui-state-highlight", 1500);
}, 500);
}
function checkLength(o, n, min, max) {
if (o.val().length > max || o.val().length < min) {
o.addClass("ui-state-error");
updateTips("Length of " + n + " must be between " + min + " and " + max + ".");
return false;
} else {
return true;
}
}
function checkRegexp(o, regexp, n) {
if (!(regexp.test(o.val()))) {
o.addClass("ui-state-error");
updateTips(n);
return false;
} else {
return true;
}
}
$("#dialog-form").dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
"Enter": function () {
var bValid = true;
allFields.removeClass("ui-state-error");
bValid = bValid && checkLength(password, "password", 5, 16);
// From jquery.validate.js (by joern), contributed by Scott Gonzalez:
// http://projects.scottsplayground.com/email_address_validation/
bValid = bValid && checkRegexp(password, /^([0-9a-zA-Z])+$/, "Password field only allow : a-z 0-9");
if (password.val() != "1234") {
return false;
}
if (password.val() == "1234") {
window.location.href = './Frm_Device.aspx';
alert("1234 ast");
if (bValid) {
$("#users tbody").append("<tr>" +
"<td>" + name.val() + "</td>" +
"<td>" + email.val() + "</td>" +
"<td>" + password.val() + "</td>" + "</tr>");
$(this).dialog("close");
return true;
}
}
},
Exit: function () {
$(this).dialog("close");
}
},
close: function () {
allFields.val("").removeClass("ui-state-error");
}
});
$("#create").button().click(function () {
$("#dialog-form").dialog("open");
return false;
});
});
我有一个 Telerik 按钮。我想知道我应该如何在这个按钮中调用 jQuery。
<telerik:RadButton ID="create" runat="server" Text="RadButton"
AutoPostBack="False" ToolTip="combined data recovered from the Teams"
class="create" OnClientClicked="?">
</telerik:RadButton>
在上面的代码中,而不是?,我应该放什么?