我的来源是在IE中工作,但在Mozilla中没有。请帮帮我。
<script type="text/javascript">
<!--
var adOpenDynamic = 2;
var adLockOptimistic = 3;
/* Path of database.
*/
var strDbPath = "..\\SRVGdb.mdb";
/*
Here is the ConnectionString for Microsoft Access.
If you want to use SQL or other databases, you hav to change the connection string..
eg: SQL => var conn_str = "Provider=sqloledb; Data Source=itdev; Initial Catalog=pubs; User ID=sa;Password=yourpassword";
*/
var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDbPath;
function getAdoDb(strAdoType) {
if (window.ActiveXObject) {
return new ActiveXObject(strAdoType);
}
else {
return ActiveXObject(strAdoType);
}
}
function showReports() {
try {
var tablevar="<table width=\"100%\" border=\"1\">"
+" <tr><td></td>"
+" </tr>";
//Database Connection
var conn = getAdoDb("ADODB.Connection");
conn.open(conn_str, "", "");
//Recordset
var rs = new ActiveXObject("ADODB.Recordset");
strQuery = "SELECT * FROM GuestBook";
rs.open(strQuery, conn, adOpenDynamic, adLockOptimistic);
if (!rs.bof) {
rs.MoveFirst();
while(!rs.eof) {
if(document.layers){
document.getElementById("one").open();
document.getElementById("one").close();
}
else {
tablevar+=" <tr>"
+" <td>"+"Sur Name: <br> Fore Name: <br> Home Address: <br> PinCode: <br> Contact Number: <br> E-mail: <br> Date of Birth: <br> Nationality: <br> University: <br> Available Timings: <br> Interested Courses: <br> Other Courses: <br> Expected Money: <br> Any More Information: <br> "+"</td>"
+" <td>"+rs.fields(0).value+"<br>"+rs.fields(1).value+"<br>"+rs.fields(2).value+"<br>"+rs.fields(3).value+"<br>"+rs.fields(4).value+"<br>"+rs.fields(5).value+"<br>"+rs.fields(6).value+"<br>"+rs.fields(7).value+"<br>"+rs.fields(8).value+"<br>"+rs.fields(9).value+"<br>"+rs.fields(10).value+"<br>"+rs.fields(11).value+"<br>"+rs.fields(12).value+"<br>"+rs.fields(13).value+"<br></td>"
+" </tr>";
document.getElementById("one").innerHTML=tablevar;
}
rs.MoveNext();
}
}
else{
if(document.layers){
document.getElementById("one").open();
document.getElementById("one").close();
}
else{
document.all("one").innerHTML="No Records To Display.";
}
//No Records.
}
conn.close();
tablevar+= "</table>";
} catch(ex) {
alert(ex.message);
}
}
//-->
</script>
提前致谢