document.write(s + "\n");

解决方案 »

  1.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
    <title>测试</title>
    </head>
    <script>
    var db_name = "TestDb.mdb"; function connect() {
    var dbc = new ActiveXObject("ADODB.Connection");
    var dbcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + location.href.replace(/file:[/]+([A-Z]:.*[/])([^/]+)/,"$1")+db_name;
    dbc.Open(dbcon);
    return dbc;
    }function gen() {
    var conn = connect();
    var rs = conn.Execute("select * from data ");
    document.open() ;
    var i = 0 ;
    while (! rs.Eof) 
    {
            i ++ ;
             var s = rs("title").value;
             document.write(i) ;
             document.write("  " + s + "\n"); // 还是不行
             rs.MoveNext ;
    }
    document.close();
    rs.Close();
            conn.Close();
    }
    </script>
    <body onLoad="gen()">
    正在初始化系统,请稍候...
    </body>
    </html>
      

  2.   

    document.write("  " + s + "<br>");
      

  3.   

    或者放在表里不是更好?
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
    <title>测试</title>
    </head>
    <script>
    var db_name = "TestDb.mdb"; function connect() {
    var dbc = new ActiveXObject("ADODB.Connection");
    var dbcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + location.href.replace(/file:[/]+([A-Z]:.*[/])([^/]+)/,"$1")+db_name;
    dbc.Open(dbcon);
    return dbc;
    }function gen() {
    var conn = connect();
    var rs = conn.Execute("select * from data ");
    document.open() ;
    var i = 0 ;         document.write("<table>"); 
    while (! rs.Eof) 
    {
            i ++ ;
             var s = rs("title").value;
             document.write("<tr><td>" + s + "</td></tr>"); // 还是不行
             rs.MoveNext ;
    }
             document.write("</table>"); 
    document.close();
    rs.Close();
            conn.Close();
    }
    </script>
    <body onLoad="gen()">
    正在初始化系统,请稍候...
    </body>
    </html>
    没调试,你试试看