AJAX DWR
使用原始的XMLHttpRequest发出请求时,只能对Servlet和JSP操作
在JSP中创建3个function
1.createXmlHttpRequest----负责判断浏览器类型创建 XMLHttpRequest对象
var xmlHttpRequest;
function createXMLHttpRequest(){
// IE 浏览器
if(window.ActiveXObject){
return new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
// 非IE浏览器
return new XMLHttpRequest();
}
}
2.doLogin------负责更加创建好的XMLHttpRequest对象发出请求
function doLogin(obj){
var url = "servlet/LoginServlet?userName="+obj.value;
// 1. 创建XMLHttpRequest组件
xmlHttpRequest = createXMLHttpRequest();
// 2. 设置回调函数
xmlHttpRequest.onreadystatechange = haoLeJiaoWo;
// 3. 初始化XMLHttpRequest组件
// 使用get方法调用URL,true代表是异步的
xmlHttpRequest.open("GET",url,true);
// 4. 发送请求
xmlHttpRequest.send(null);
alert("123");
}
3.haolejiaowo---负责进行回调处理
function haoLeJiaoWo(){
// readyState-- =4表示得到了返回结果
// status=200 表示成功而且不出错
/*
请求状态:
0 -- 未初始化
1 -- 初始化
2 -- 发送请求
3 -- 开始接受结果
4 -- 接受结果完毕
每次状态改变都会调这个函数
*/
if( xmlHttpRequest.readyState == 4 &
相关文档:
AJAX自从引进了Tab,着实让我开心了一番。但是,在调整Tab的样式的时候,也着实让我吃了一惊。
于是,抱着没有困难也要制造困难的原则,开始了征途:
按照Tab作者Ronald Buckton所说,Tab的CSS包含如下几个类:
(1).ajax__tab_header: A container element that wraps all of the tabs at the top of the TabContainer.
......
如上图所示的等级控件(这个控件主要指定样式):
页面代码:
<head runat="server">
<title>无标题页</title>
<mce:style type ="text/css"><!--
.ratingStar
{
font-size:0pt;
width:15px;
height:12px;
......
<html>
<body>
<script type="text/javascript">
function ajaxFunction()
{
var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Inte ......
页面代码:
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManage ......
http://hi.baidu.com/cxzhang/blog/item/0166563892cc65fbb211c7b0.html.
http://topic.csdn.net/t/20030527/22/1842509.html
using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using System.Reflection;
public class ToJson
{
/// <summary>
......