CustomValidator¿Ø¼þ+ajax ʵÏÖ×¢²áʱµÄÒì²½ÑéÖ¤
ÔÚ.netµÄÑéÖ¤¿Ø¼þÖÐÓÐÒ»¸öCustomValidatorÑéÖ¤¿Ø¼þ£¬ÆäÊôÐÔClientValidationFunctionΪ¿Í»§¶Ëº¯Êý£¬ÔÚÐèÒªÑéÖ¤µÄ¿Ø¼þʧȥ½¹µã»òÕßpostÊý¾Ýʱ£¬µ÷Óøú¯Êý¡£
ǰ̨£º
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomValidatorTest.aspx.cs" Inherits="Web.CustomValidatorTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<mce:script type="text/javascript" src="jquery/jquery-1.2.6-vsdoc-cn.js" mce_src="jquery/jquery-1.2.6-vsdoc-cn.js"></mce:script><%--jqueryÎļþ--%>
<mce:script type="text/javascript"><!--
function validator(oSrc, args) {
//oSrc Ϊobject ÀàÐÍ£¬ÎªCustomValidator1¶ÔÏó
//argsΪÓÐÁ½¸öÊôÐÔ£ºValueΪÑéÖ¤¿Ø¼þµÄÖµ£¬
// IsValid ΪboolÀàÐÍ£¬±íʾÊÇ·ñÑé֤ͨ¹ý
$.ajax({
async: false, //ͬ²½£¬Òì²½²»ÐУ¬ÔÚajaxΪ·µ»Ø֮ǰ£¬º¯Êý¾Í½áÊø£¬Ìá½»IsValidµÄÖµÁË¡£
type: "POST",
url: "CustomValidatorTestHander.ashx",
data: "val=" + args.Value,
success: function(msg) {
if (msg == "123") {
//Èç¹ûºǫ́·µ»ØֵΪ123£¬Ñé֤ʧ°Ü
args.IsValid = false;
//todo
//ÕâÀïÊÇ·ñ¿ÉÒÔÐÞ¸ÄoSrc¶ÔÏóÀ´ÊµÏÖÒì²½ÇëÇóÄØ£¿
}
}
});
}
// --></mce:script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>ÊäÈë123Ñé֤ʧ°Ü£º</td>
<td><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></td>
<td><asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="ÑéÖ¤²»Í¨¹ý"
Ïà¹ØÎĵµ£º
function selectTradezone(){
var copyTradezone = document.forms[0].copyTradezone;
new BaseTool().ajax("getTradezoneByCity",callback,[document.forms[0].city.value,document.forms[0].brand.value]);
function callba ......
//==================>¡¾index.jsp¡¿===============================
<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<% String path=request.getContextPath(); %>
<%@page import="com.sinoest.dfrf.orm.pojo.Mainmenu"%>
<%@page import="com.si ......
Dojo1.3.x
µÄ
Ajax
ʾÀý
ÕûÀíÈË£º»Æ³Ï
QQ
Ⱥ£º
65643887
ÕâƪÎÄÕÂÖ÷ÒªÊÇ°ïÖú¶Ô
Dojo
¸ÐÐËȤµÄÅóÓÑÃÇ¿ì
ËÙʵÏÖÍøÕ¾ÉϵÄÀý×Ó¡£
http://sitepen.com/labs/guides/?guide=DojoQuickStart#Ajax
Ëü½Ì³Ì·ÖÁË
3
²¿·Ö£¬ÆäÖеÄÀý×Ó²»ÈÝÒ×
ÉÏÊÖ¡£ÎÒÕâÀïÌṩһ¸ö´ò°üÎļþ
AjaxWithDojo.war
ÏÂÃæÎÒ½«Ïêϸ˵Ã÷²Ù×÷²½Ö ......
<script type="text/javascript">
function addUrl(){
//1¡¢ÉèÖÃÇëÇóurlµØÖ·
var name = document.getElementById("name").value;
var text = document.getElementById("url").value;
var url = "insertUrl.do?name="+name+
"&url="+text+"&time"+new Date() ;
//2¡¢´´½¨xmlHttpRequest¶ÔÏó
x ......
»ìãç³õ¿ª£¬Ò»Çж¼ÄÇô¼òµ¥¡£ÎªÁËÁ¬½ÓÃÀ¹úµÄÉÙÊý¼¸¸ö¶¥¼âÑо¿»ú¹¹£¬ÈËÃÇÉè¼ÆÁË×îÔçµÄ“Internet”£¬ÒԱ㹲ͬ¿ªÕ¹¿ÆѧÑо¿¡£²»ÂÛÊÇͼÊé¹ÝÔ±¡¢ºËÎïÀíѧ¼Ò£¬»¹ÊǼÆËã»ú¿Æѧ¼Ò£¬¶¼±ØÐëѧϰһ¸öÏ൱¸´ÔÓµÄϵͳ¡£1962Ä꣬ÂéÊ¡Àí¹¤Ñ§Ôº£¨MIT£©µÄJ.C.R. Licklider×îÔçÌá³öËûµÄ“Galactic Network”£¨³¬´óÍøÂç£©Ë ......