建议采取用动态语言读取数据库 比如 asp php jsp asp.net等都可以
然后用javascript 去提交参数给动态页面,也就是所谓的ajax的方式.
理论上不建议这样连,但是也可以连的
代码如下:
<script type="text/javascript" language="javascript" charset="gb2312"><!--
function getCountFromDB() {
var filePath = location.href.substring(0, location.href.indexOf("index.html"))
var path = filePath + "MyData.mdb"
path = path.substring(8)
var updateCnt = 0
var sqlSelCnt = "SELECT * FROM [user]"
var con = new ActiveXObject("ADODB.Connection")
con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.ConnectionString = "Data Source=" + path
con.open
var rs = new ActiveXObject("ADODB.Recordset")
rs.open (sqlSelCnt,con)
while (!rs.eof) {
var cnt = rs.Fields("content")
document.write (cnt)
rs.moveNext
}
rs.close()
rs = null
}