本文整理匯總了C#中jQueryApi.jQueryEvent.PreventDefault方法的典型用法代碼示例。如果您正苦於以下問題:C# jQueryEvent.PreventDefault方法的具體用法?C# jQueryEvent.PreventDefault怎麽用?C# jQueryEvent.PreventDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jQueryApi.jQueryEvent
的用法示例。
在下文中一共展示了jQueryEvent.PreventDefault方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: InputKeypressHandler
public static void InputKeypressHandler(jQueryEvent evt, InputElement el, TransformCharDelegate transformChar) {
if (evt.AltKey || evt.CtrlKey)
return; // don't ever change Alt+key or Ctrl+key
if (jQuery.Browser.MSIE) {
if (evt.Which == 13)
return; // Enter seems to be the only non-printable key we catch in IE.
char newc = transformChar((char)evt.Which);
if (newc == 0) {
evt.PreventDefault();
}
else if (newc != evt.Which) {
((dynamic)evt).originalEvent.keyCode = newc;
}
}
else {
if (evt.Which == 0)
return; // Firefox, and likely other non-IE browsers, lets us trap non-characters, but we don't want that.
char newc = transformChar((char)evt.Which);
if (newc == 0) {
evt.PreventDefault();
}
else if (newc != evt.Which) {
int startPos = ((dynamic)el).selectionStart,
endPos = ((dynamic)el).selectionEnd;
string oldVal = el.Value;
el.Value = oldVal.Substr(0, startPos) + String.FromCharCode(newc) + oldVal.Substr(endPos);
((dynamic)el).setSelectionRange(startPos + 1, startPos + 1);
evt.PreventDefault();
}
}
}
示例2: SubmitForm
private void SubmitForm(jQueryEvent e)
{
e.PreventDefault();
string currentPassword = jQuery.Select("#change-password-current-password").GetValue();
string password = jQuery.Select("#change-password-new-password").GetValue();
string password2 = jQuery.Select("#change-password-new-password2").GetValue();
if (currentPassword == "" || password == "" || password2 == "" || submittingForm)
{
return;
}
if (password.Length < 8 || password != password2)
{
ErrorModal.ShowError(Strings.Get("AddUserInvalidInput"));
return;
}
submittingForm = true;
ChangePasswordRequest request = new ChangePasswordRequest();
request.currentPassword = currentPassword;
request.newPassword = password;
request.newPassword2 = password2;
Request.Send(request, SubmitSuccess, SubmitFailure);
}
示例3: OnAddNearbyClick
private void OnAddNearbyClick(jQueryEvent e)
{
try
{
Service.GetSurroundingPlaces(
int.Parse(this.view.uiRadiusPlaceAutoComplete.Value),
int.Parse(this.view.uiNumberOfSurroundingTownsDropDown.Value),
delegate(PlaceStub[] result, object context, string name)
{
for (int i = 0; i < result.Length; i++)
{
this.view.uiPlacesMultiSelector.AddItem(result[i].name, result[i].k.ToString());
}
this.view.uiRadiusPlaceAutoComplete.Clear();
},
Trace.WebServiceFailure,
null,
5000
);
}
catch(Exception)
{
}
e.PreventDefault();
}
示例4: OnKeyDown
private void OnKeyDown(jQueryEvent e)
{
if ("ABCDEFGHIJKLMNOPQRSTUVWXYZ,.;#[]".IndexOf(String.FromCharCode(e.Which)) > -1)
{
e.PreventDefault();
}
}
示例5: SubmitForm
private void SubmitForm(jQueryEvent e)
{
e.PreventDefault();
string name = jQuery.Trim(jQuery.Select("#admin-user-add-name").GetValue());
string password = jQuery.Select("#admin-user-add-password").GetValue();
string password2 = jQuery.Select("#admin-user-add-password2").GetValue();
if (name == "" || password == "" || password2 == "" || submittingForm)
{
return;
}
RegularExpression regex = new RegularExpression("[^a-zA-Z0-9]");
if (regex.Test(name) || password.Length < 8 || password != password2)
{
ErrorModal.ShowError(Strings.Get("AddUserInvalidInput"));
return;
}
submittingForm = true;
AdminUserAddRequest request = new AdminUserAddRequest();
request.username = name;
request.password = password;
request.password2 = password2;
request.admin = jQuery.Select("#admin-user-add-administrator").Is(":checked");
Request.Send(request, SubmitSuccess, SubmitFailure);
}
示例6: ReportLinkClick
private void ReportLinkClick(jQueryEvent e)
{
e.PreventDefault();
var dialog = new ReportDialog(new ReportDialogOptions
{
ReportKey = J(e.Target).GetDataValue("key").As<string>()
});
}
示例7: NavMangasClicked
private void NavMangasClicked(jQueryEvent e)
{
e.PreventDefault();
if (this.GetType() != typeof(AdminMangasModule))
{
AdminMangasModule.Instance.Show(null);
}
}
示例8: NavLogoutClicked
private void NavLogoutClicked(jQueryEvent e)
{
e.PreventDefault();
LoginRequest request = new LoginRequest();
request.password = "logout";
Request.Send(request, LogoutSuccessful, LogoutSuccessful);
}
示例9: NavSettingsClicked
private void NavSettingsClicked(jQueryEvent e)
{
e.PreventDefault();
if (this.GetType() != typeof(SettingsModule))
{
SettingsModule.Instance.Show(null);
}
}
示例10: NavFoldersClicked
private void NavFoldersClicked(jQueryEvent e)
{
e.PreventDefault();
if (this.GetType() != typeof(FoldersModule))
{
FoldersModule.Instance.Show(null);
}
}
示例11: GoLicense
void GoLicense(jQueryEvent evt)
{
evt.PreventDefault ();
Work.Empty ();
Work.Append (@"<div class=""well"">
<p>Copyright AICL.</p>
<p>Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:</p><p><a target=""_blank"" href=""http://www.apache.org/licenses/LICENSE-2.0"">http://www.apache.org/licenses/LICENSE-2.0</a></p><p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an ""AS IS"" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p></div>");
}
示例12: BrowseButtonClicked
private void BrowseButtonClicked(jQueryEvent e)
{
e.PreventDefault();
if (collectionId > 0)
{
AdminFinderModal.ShowDialog(jQuery.Select("#admin-manga-edit-path"), collectionId);
}
}
示例13: GoContact
void GoContact(jQueryEvent evt)
{
evt.PreventDefault ();
Work.Empty ();
Work.Append (@"<div class=""well"">
<p><a target=""_blank"" href=""https://github.com/angelcolmenares"">https://github.com/angelcolmenares</a>
<p><a target=""_blank"" href=""https://github.com/aicl"">https://github.com/aicl</a>
</p></div>");
}
示例14: GoAbout
void GoAbout(jQueryEvent evt)
{
evt.PreventDefault ();
Work.Empty ();
Work.Append (@"<div class=""well"">
<p>Cayita is a library for building responsive webapps using C# as base language and the Saltarelle compiler
<a href=""http://www.saltarelle-compiler.com"" target=""_blank"">
http://www.saltarelle-compiler.com
</a>
</p>
</p></div>");
}
示例15: KeyDown
protected void KeyDown(jQueryEvent e)
{
if (e.Which == (int)39/*Key.Right*/)
{
if (OnArrowKeyPress != null)
OnArrowKeyPress(this, EventArgs.Empty);
if (OnPhotoNextClick != null)
OnPhotoNextClick(this, EventArgs.Empty);
e.PreventDefault();
}
else if (e.Which == (int)37/*Key.Left*/)
{
if (OnArrowKeyPress != null)
OnArrowKeyPress(this, EventArgs.Empty);
if (OnPhotoPrevClick != null)
OnPhotoPrevClick(this, EventArgs.Empty);
e.PreventDefault();
}
//else if (e.KeyCode == (int)Key.Up)
//{
// if (OnArrowKeyPress != null)
// OnArrowKeyPress(this, EventArgs.Empty);
// if (OnPhotoUpClick != null)
// OnPhotoUpClick(this, EventArgs.Empty);
// e.PreventDefault();
//}
//else if (e.KeyCode == (int)Key.Down)
//{
// if (OnArrowKeyPress != null)
// OnArrowKeyPress(this, EventArgs.Empty);
// if (OnPhotoDownClick != null)
// OnPhotoDownClick(this, EventArgs.Empty);
// e.PreventDefault();
//}
else
{
NonArrowKeyDown(e);
}
}