javascript, json, xml
¡¾×ª×Ô¡¿http://www.cnblogs.com/chenxizhang/archive/2010/01/13/1646255.html
ÔÚÍøÂç±à³ÌÖУ¬ÎÒÃǾ³£ÐèÒªÓõ½javascript,ÕâЩ¿Í»§¶Ë½Å±¾ÓÖ¾³£ÐèÒªÓë·þÎñ¶Ë½øÐÐÒì²½µÄͨѶ£¬Ìá½»²¢½ÓÊÕÊý¾Ý¡£ÏÂÃæÕâ¸öÀý×ÓÑÝʾÁËÈçºÎÉè¼Æ·þÎñ£¬ÈçºÎ±àд½Å±¾
1. ·þÎñ¶Ë£¬ÕâÊÇÒ»¸öashxÎļþ
ÐèÒªÌí¼ÓÁ½¸öÒýÓà System.Runtime.SerializationºÍSystem.ServiceModel.Web
using System.Web;
using System.Web.Services;
using System.Runtime.Serialization.Json;
using System.Runtime.Serialization;
using System.IO;
using System.Text;
namespace DynamicTableSample
{
/// <summary>
/// $codebehindclassname$ µÄժҪ˵Ã÷
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Test : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
//½âÎö¿Í»§¶Ë´«¹ýÀ´µÄÊý¾Ý
var c = context.Request["data"];
var ser = new DataContractJsonSerializer(typeof(Customer));
Customer customer =ser.ReadObject(new MemoryStream(Encoding.UTF8.GetBytes(c))) as Customer;//·´ÐòÁл¯£¬½«×Ö·û´®×ª»»Îª¶ÔÏó
//·µ»Ø½á¹û
ActionResult result = new ActionResult() { ResultCode = 200, Message = "¸Ã²Ù×÷ÒѾ³É¹¦" };
var ser2 = new DataContractSerializer(typeof(ActionResult));
//Ö±½Ó·µ»Øxml¸ñʽµÄÄÚÈÝ¡£·µ»ØxmlÆäʵÊǸüºÃµÄ£¬ÒòΪÕâ¸ö·þÎñ²Å¸üÓÐͨÓÃÐÔ¡£
ser2.WriteObject(context.Response.OutputStream, result);
}
public bool IsReusable
{
get
{
return false;
}
}
}
public class Customer {
public string CustomerID { get; set; }
public Employee[] Employees { get; set; }
public class Employee
{
public int Id { get; set; }
public string Name { get; set; }
}
}
public class ActionResult
{
public int ResultC
Ïà¹ØÎĵµ£º
<html>
<head>
<title>test javaScript</title>
//cssÉèÖÃͼÏñµÄ͸Ã÷¶È
<mce:style><!--
img
{
filter:alpha(opacity=10)
}
--></mce:style><style mce_bogus="1">img
{
filter:alpha(opacity=10)
}</style>
<mce:script type="text/javasc ......
ÔÚÉÏÃæµÄʾÀýÖУ¬ÎÒÃǶ¨ÒåÁËÁ½¸öÓï·¨¸Ê¶£¬Ò»¸öÊÇClass()º¯Êý£¬Ò»¸öÊÇNew()º¯Êý¡£Ê¹ÓÃClass()¸Ê¶£¬ÎÒÃÇÒѾ¿ÉÒÔÓ÷dz£ÓÅÑŵĸñʽ¶¨ÒåÒ»¸öÀà¡£ÀýÈçÇ°ÀýÖеģº
var
Employee
=
Class(Person,
//
ÅÉÉúÖÁPersonÀà
{
......
Ò³ÃæÄÚǶ²»Í¬µÄÍøÒ³ÄÚÈÝʱ£¬µ¼ÖÂiframeµÄ¸ß¶ÈÎÞ·¨ÓëʵÏÖÄÚÈÝ»òä¯ÀÀÆ÷¸ß¶ÈÏàÆ¥Åä¡£´°¿Ú´óС±ä»»Ê±£¬²»ÄÜiframe²»ÄܽøÐÐ×Ô¶¯µ÷Õû¡£ÕâÀÎÒÃÇÀûÓÃJAVASCRIPTÈÃIFRAME¿ò¼ÜµÄ¸ß¶È×ÔÊÊÓ¦¡£
Ê×ÏÈ£¬Ð´³öÈçϵÄJS·½·¨¡£
/**
* ÄÚǶҳÃæµÄ¸ß¶ÈÉèÖÃ
*/
function handleFrameLoad() {
var hDoc = getBodyHeight(document);
var ......
substr() ·½·¨¿ÉÔÚ×Ö·û´®ÖгéÈ¡´Ó start ϱ꿪ʼµÄÖ¸¶¨ÊýÄ¿µÄ×Ö·û.
stringObject.substr(start,length);start±ØÐë,length¿ÉÑ¡.
start ÊǽØÈ¡µÄ¿ªÊ¼Î»ÖõÄϱê,´Ó0¿ªÊ¼ËãÆð,±ØÐëÊÇÊý×Ö.¿ÉÒÔÊǸºÊý,-1Êǵ¹ÊýµÚÒ»¸ö×Ö·û,-2Êǵ¹ÊýµÚ¶þ¸ö×Ö·û,ÒÔ´ËÀàÍÆ.
length ÊÇÒª½ØÈ¡µÄ×Ö·ûµÄ³¤¶È,±ØÐëÊÇÊý×Ö.Èç¹ûδָ¶¨,Ôò´ÓstartλÖô¦¿ ......
±Õ°ü£¨closure£©ÊÇJavascriptÓïÑÔµÄÒ»¸öÄѵ㣬ҲÊÇËüµÄÌØÉ«£¬ºÜ¶à¸ß¼¶Ó¦Óö¼ÒªÒÀ¿¿±Õ°üʵÏÖ¡£
ÏÂÃæ¾ÍÊÇÎÒµÄѧϰ±Ê¼Ç£¬¶ÔÓÚJavascript³õѧÕßÓ¦¸ÃÊǺÜÓÐÓõġ£
Ò»¡¢±äÁ¿µÄ×÷ÓÃÓò
ÒªÀí½â±Õ°ü£¬Ê×ÏȱØÐëÀí½âJavascriptÌØÊâµÄ±äÁ¿×÷ÓÃÓò¡£
±äÁ¿µÄ×÷ÓÃÓòÎ޷ǾÍÊÇÁ½ÖÖ£ºÈ«¾Ö±äÁ¿ºÍ¾Ö²¿±äÁ¿¡£
JavascriptÓïÑÔµÄÌØÊâÖ®´¦£¬¾ÍÔÚÓ ......