本工具用于解决部分环境不能操作系统对话框的问题
来源<script><br/>var dbpath = location.href.replace(/file:[/]+([A-Z]:.*[/])([^/]+)/,"$1");<br/><br/>function connect(db_name) {<br/> var dbc = new ActiveXObject("ADODB.Connection");<br/> var dbcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +db_name;<br/> dbc.Open(dbcon);<br/> return dbc;<br/>}<br/><br/>function query(sql) {<br/> var conn = connect(dbpath+"netBook.mdb"); // 连接数据库<br/> conn.Execute(sql);<br/> conn.Close();<br/>}<br/><br/>function splitData() {<br/> name = document.all.sfile.value;<br/> moveData(name,dbpath+"netBook.mdb","");<br/> query("update data set cote=0 where cote not in (select id from itemlist)");<br/>}<br/><br/>function addslashes(s) {<br/> return s.replace(/'/g,"''");<br/>}<br/><br/>// 复制db1的数据到db2<br/>function moveData(db1,db2,exrp) {<br/> if(! exrp) exrp = "";<br/> conn1 = connect(db1);<br/> conn2 = connect(db2);<br/> rs = conn1.Execute("select * from data "+exrp);<br/> while(!rs.EOF) {<br/> conn2.Execute("insert into data values ("+rs("id").value<br/> +","+rs("cote").value<br/> +",'"+rs("author").value+"'"<br/> +",'"+addslashes(rs("title").value)+"'"<br/> +",'"+addslashes(rs("content").value)+"'"<br/> +",'"+rs("type").value+"'"<br/> +",'"+rs("soruce").value+"'"<br/> +")");<br/> rs.MoveNext();<br/> }<br/> rs.Close();<br/> conn1.Close();<br/> conn2.Close();<br/>}<br/></script>