Ajax¿Ø¼þ½é紹 1
Ajax¿Ø¼þ½é紹
1. Accordion
¡¾¹¦ÄܸÅÊö¡¿Accordion¿ÉÒÔÈÃÄãÉè¼Æ¶à¸öpanel ²¢ÇÒÒ»´ÎÖ»ÏÔʾһ¸öPanel .ÔÚÒ³ÃæÉϵÄÏÔʾЧ¹û¾ÍÏñÊÇʹÓÃÁ˶à¸öCollapsiblePanelsÖ»²»¹ýÿһ´ÎÖ»Õ¹¿ªÆäÖÐÒ»¸öCollapsiblePanel.Accordion¿Ø¼þÄÚ²¿°üº¬ÁËÈô¸É¸öAccordionPane£¬Ã¿Ò»¸öAccordionPaneµÄtemplateÀï°üÀ¨Á˶ÔÆäHeaderºÍContentµÄ¶¨Òå¡£ÎÒÃÇ¿ÉÒÔÔÚºǫ́´úÂëÖÐͨ¹ýSelectedIndexÊôÐÔÈ¡µÃµ±Ç°Õ¹¿ªµÄÄÄÒ»¸öPanel£¬»¹¿ÉÒÔ¿ØÖÆÄÄÒ»¸öPanelÕ¹¿ª¡£
¾³£¿ÉÒÔ¼ûµ½ÀàËƵÄЧ¹û£¬±ÈÈçQQ¡¢MsnºÃÓÑ·ÖÀàµÄÕÛµþЧ¹û¡£
¡¾Ï¸½Ú¡¿
(1)²»Òª°ÑAccordion·ÅÔÚTableÖжøÓÖ°Ñ FadeTransitions ÉèÖÃΪTrue£¬Õ⽫ÒýÆð²¼¾Ö»ìÂÒ
(2) ÔÚAccordionPaneÄ£°åÖеÄContentÖпÉÒÔ¶¨ÒåÈκÎWebÔªËØ£¬±íÏֵľÍÏñÒ»¸öÈÝÆ÷
(3) AccordionPaneÄÚÈÝÄ£°å×Ô¶¯¸Ä±ä´óСÓÐÈýÖÖAutoSize modes £ºNone(ÍƼö) Limit Fill
(4) $find('ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender')ÕâÀïÕÒµ½µÄÊÇBehavior.ʲôÊÇBehaviorÄØ£¿ÔÚAsp.net Ajax¿ò¼ÜÖаüº¬Ò»×鶯×÷²¢Íê³ÉÒ»¸ö¹¦ÄÜ. AccordionµÄÒ»¸öBehavior¾ÍÊǵÈëµ³ö.
ÕÒµ½BehaviorµÄÒýÓã¬behavior.set_FadeTransitions() behavior.get_FadeTransitions()µÄ·½Ê½À´ÊµÏÖ¾ßÌåijһ¸öBehaviorµÄ·ÃÎʺÍÐÞ¸Ä.
var behavior = $find('ctl00_SampleContent_MyAccordion_AccordionExtender');ÕâÖÖд·¨ÊDz»ºÃµÄ£¬ÎÒÃÇÔÚ×Ô¶¯²âÊÔµÄÒ³ÃæÖз¢ÏÖÁ˸üºÃµÄд·¨£º var behavior=$find("<%= MyAccordion.ClientID %>_AccordionExtender");
¡¾´úÂëʾÒâ¡¿
<script language="javascript" type="text/javascript">
function toggleFade()
{
var behavior = $find('ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender');
if (behavior)
{
behavior.set_FadeTransitions(!behavior.get_FadeTransitions());
}
}
function changeAutoSize()
{
var behavior = $find('ctl00_ContentPlaceHolder1_MyAccordion_AccordionExtender');
var ctrl = $get('autosize'); //ÕâÀïÕÒµÄÊÇÏÂÀÁбí¿Ø¼þ,²»ÊÇBehavior
if (behavior)
{
var size = 'None'; // ÕâÀï˳±ã¿´¿´ÔõôʹÓÃSelect
switch (ctrl.selectedIndex) {
Ïà¹ØÎĵµ£º
//JS´úÂë
function checkname() {
var Msg = document.getElementById("d_username");
var chk = CheckN();
if (chk) {
$.ajax({ url: 'registerOK.aspx',
& ......
´«Í³ÐÍASP.NET Web FormsÊÇ»ùÓÚͬʱ°üº¬Á˱íÏÖ²ãºÍºǫ́´úÂëµÄWebÒ³Ã棬ËùÒÔ£¬½ôËæÆäºó³öÏÖµÄASP.NET AJAX£¬ÌرðÊÇÕâ¸ö¿ò¼ÜµÄ·þÎñÆ÷¶Ë¿Ø¼þ²¢Ã»ÓÐÏñËüÃDZ¾Ó¦¸ÃµÄÄÇÑù¹ââËÄÉä¡£ÓÚÊÇ£¬ºÜ¶à¸úËæAJAXʱ÷ÖµÄASP.NET¿ª·¢ÕßÖ»ÊÇÏòASP.NETÒ³ÃæÖÐËæÒâµØ·ÅÖÃһЩUpdatePanel¿Ø¼þÒÔ±ãʹÆä³ÌÐòʵÏÖ»ù±¾µÄAJAXÖ§³Ö¡£Êµ¼Ê ......
ʹÓÃAjaxÎÞË¢ÐÂÉÏ´«ÎļþÊǵ±Ç°±È½ÏÁ÷ÐеŦÄÜ¡£½èÖúJQueryÇ¿´óµÄ²å¼þ£¬ÏÖÔÚÒѾ¿ÉÒÔºÜÈÝÒ×ÁË¡£
Ê×Ïȵ¼ÈëjsÎļþjquery.ajaxfileupload.js¡£´Ë²å¼þµÄÔÀíÊÇÔÚÎĵµÖд´½¨iframeºÍformÈ»ºóÔÚ½«ÎļþÉÏ´«µ½·þÎñÆ÷¡£
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head id="Head ......
<script type="text/javascript">
//¶¨ÒåXMLHttpRequest¶ÔÏó±äÁ¿
var xmlHttpRequest;
/*
* ´´½¨XMLHttpRequest¶ÔÏó¡£
* ±¾º¯ÊýÖ÷ÒªÍê³ÉXMLHttpRequest¶ÔÏóµÄ´´½¨£¬ºËÐÄ·ÖΪÒÔÏÂÁ½¸ö²¿·Ö£º
* µÚÒ»²½£ºÊ×ÏÈÅж ......
HTML´úÂëÈçÏÂ:
LoginValidate.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LoginValidate.aspx.cs" Inherits="LoginValidate" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ÑéÖ¤Óû§ÃûÊÇ·ñ´æÔÚ</title>
<script type="text/j ......