'/// <summary>
'/// 执行Recordset
'/// </summary>
'/// <param>连接字符</param>
'/// <param>sql命令</param>
'/// <returns>RS</returns>
Public Function Recordset(connString,cmdText)
Dim objConn,objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connString
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open cmdText,objConn,1,3
Set Recordset = objRS
End Function
Private Sub Class_Initialize()
CONN_STRING = "provider = microsoft.jet.oledb.4.0;data source=" & Server.Mappath("db.mdb")
End Sub
End Class
%>
ajax.js
复制代码 代码如下:
var http_request = false;
function makeRequest(obj,url) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
http_request.onreadystatechange = function()
{
if (http_request.readyState == 4) {
if (http_request.status == 200) {
updateObj(obj,http_request.responseText);
}
else
{
updateObj(obj,"");
}
}
}
http_request.open('GET', url, true);
http_request.send(null);
}
function updateObj(obj,data){
obj.innerHTML = data;
}
function $(url){
var obj = document.getElementById("content");
obj.style.display='block';
document.getElementById("container").style.margin="10px auto 0px";
obj.innerHTML = "Loading…";
makeRequest(obj,url);
}
html调用方法:
复制代码 代码如下:
<a href="#" onclick="$('news.html')">新闻</a><a href="#" onclick="$('product.html')">产品</a><a href="#" onclick="$('case.html')">案例</a><a href="#" onclick="$('contact.html')">联系</a><a href="http://zj55com.cnblogs.com/" target="_blank">博客</a>
您可能感兴趣的文章: