请推荐几个写ajax的框架代码,感觉prototype.js太大

Go_Rush 2006-05-09 05:06:17
轻量级的就可以。

因为只是想用ajax改善一下前端界面,其实想自己写的,不过写之前
想看看人家的写法。

目前看了prototype.js。 感觉太大了,适合复杂项目使用。

有没有简单,干净利落一点的,贴个原码地址来分享一下
...全文
1070 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
Taciterry 2006-05-28
  • 打赏
  • 举报
回复
给我一个好不好?
taciterry@gmail.com
supNate 2006-05-28
  • 打赏
  • 举报
回复
我也在想着如何精简prototype呢,呵呵,的确大了点,特别是1.4.0,很多功能都用不上。
但没有又确实不方便。
Go_Rush 2006-05-26
  • 打赏
  • 举报
回复
楼上,你的那个不错,正好是我想要的那种,不大也不小,很合身啊,功能也不错
xuzuning 2006-05-26
  • 打赏
  • 举报
回复
我发给你的那个怎样?
wtogether 2006-05-25
  • 打赏
  • 举报
回复
自己写吧,更能符合自己需要些
<script language="javascript">
if (!window.XMLHttpRequest)
{
window.XMLHttpRequest = function()
{
if (window.ActiveXObject)
{
var list = ["MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];
for (var i = 0; i < list.length; i++)
{
try
{
return(new ActiveXObject(list[i]));
}
catch(ex)
{
}
}
}
throw new Error(0x53000001, "未安装XMLHttpRequest组件");
};
};

var XmlRequest = function()
{
this.core = new XMLHttpRequest();
this.head = {};
this.data = {};
this.method = "GET";
this.async = false;
this.callBack = function(){};
var xmlhttp = this;
this.content = function()
{
var obj;
var tp = "";
for (obj in xmlhttp.data)
{
if (typeof(xmlhttp.data[obj]) == "string")
{
tp += (tp == "" ? "" : "&") +
encodeURIComponent(obj) +
"=" +
encodeURIComponent(xmlhttp.data[obj]);
}
else
{
tp = xmlhttp.data[obj];
}
}
var core = xmlhttp.core;
if (typeof(tp) == "string" && xmlhttp.method == "POST")
{
core.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}
else if (typeof(tp) == "object" && xmlhttp.method == "POST")
{
core.setRequestHeader("Content-Type", "text/xml");
}
return tp;
};
this.load = function()
{
try
{
var argv = arguments;
var core = xmlhttp.core;
core.open(xmlhttp.method, argv[0], xmlhttp.async);
var obj;
for (obj in xmlhttp.head)
{
core.setRequestHeader(obj, xmlhttp.head[obj]);
};
if (xmlhttp.async == true)
{
core.onreadystatechange = xmlhttp.callBack;
}
core.send(xmlhttp.content());
if (xmlhttp.async == false && core.readyState == 4)
{
xmlhttp.translate();
}
}
catch(ex)
{
alert(ex.description);
}
};
this.translate = function()
{
var core = xmlhttp.core;
xmlhttp.readyState = core.readyState;
xmlhttp.status = core.status;
xmlhttp.responseBody = core.responseBody;
xmlhttp.responseText = core.responseText;
xmlhttp.responseXML = core.responseXML;
};
};
</script>
<script language="javascript">
//get
var http = new XmlRequest();
http.load("http://www.163.com");
var core = http.core;
if (core.readyState == 4)
{
alert(http.responseText);
}
//post
var http = new XmlRequest();
http.async = true;
http.method = "POST";
http.data['username'] = "wtogether";
http.data['password'] = "123456";
http.data['loginSelect'] = "163邮箱";
http.callBack = function()
{
var core = http.core;
if (core.readyState == 4)
{
http.translate();
alert(http.responseText);
}
};
http.load("http://reg.163.com/in.jsp?url=http://fm163.163.com/coremail/fcg/ntesdoor2?");
</script>

Scarroot 2006-05-25
  • 打赏
  • 举报
回复
mark
indexroot 2006-05-13
  • 打赏
  • 举报
回复
http://xkr.us/code/javascript/XHConn/
indexroot 2006-05-13
  • 打赏
  • 举报
回复
如果觉得prototype体积大
可以把prototype压缩一下(去掉注释换行)

或者
用XHConn非常轻量级


iuhxq 2006-05-12
  • 打赏
  • 举报
回复
prototype有些地方看不懂,怎么办?
iuhxq 2006-05-12
  • 打赏
  • 举报
回复
http://xkr.us/code/javascript/XHConn/

DotNet灵魂 2006-05-12
  • 打赏
  • 举报
回复
prototype
我一直在用它
Meteorlet 2006-05-12
  • 打赏
  • 举报
回复
http://www.tianjiaonet.com/comment.php?aid=23&BlogID=1
九型思维 2006-05-12
  • 打赏
  • 举报
回复
.net2005、asp.net2.0、flash8.0、sql2005
web2.0
【Pin】web2.0工程师,.net工程师,技术经理,flash编程&设计师,3D美工等,长期有效
如有意向,请发简历至datehr@126.com,详情请见
http://iten.126.com 或
http://blog.csdn.net/datehr/
Go_Rush 2006-05-12
  • 打赏
  • 举报
回复
看不懂还能怎么办啊,

一问google
二问csdn
三问msdn
四问.....


你的那个XHConn够小啊,还有别的吗
afoskoo 2006-05-11
  • 打赏
  • 举报
回复
prototype只是js的扩展,一点都不大.
yyszh 2006-05-11
  • 打赏
  • 举报
回复
我还没看到过比prototype小的。
蓝诺 2006-05-10
  • 打赏
  • 举报
回复
http://www.topee.cn/
刚完成的!一个高手的。呵。。
webphoenix 2006-05-10
  • 打赏
  • 举报
回复
删掉prototype里你觉得没用的代码
testdll 2006-05-09
  • 打赏
  • 举报
回复
www.joyistar.com

试试这个.
捏造的信仰 2006-05-09
  • 打赏
  • 举报
回复
prototype一点都不大。而且我没看到那个框架比它小的。
加载更多回复(1)

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧