<script language=javascript>
// ^_^
//
//(c) in 2002-2003 by Alex(Chinese:蒋健华)
//http://www.finder.net.cn
//C Email: jiangjh@finder.net.cn
//F Email: jjh_115@eyou.com
</script>
<script language=javascript>
function replace(v)
{
//容错问题,请读者自行进行判断。
//定义SQL语句
var sql = "select * from Dictionary where MainID='" + v + "'" ;
//新建数据库连接对象和数据集存取对象
var ConnDB = new ActiveXObject("adodb.connection");
var rs = new ActiveXObject("ADODB.Recordset");
//这里填入要连接的DSN
ConnDB.ConnectionString="DSN=***;uid=***;pwd=***";
ConnDB.open
rs.open(sql,ConnDB,1,1);
if (rs.RecordCount>0){
if (v==parseInt(rs("MainID"))){
//字符串连接
document.all('txt').value = v + rs("MainValue");
var sql=null;
rs.close
ConnDB.close
return;
} else {
var sql=null;
alert("没有此代号!");
txt.select();
txt.focus();
rs.close
ConnDB.close
}
}
</script>
<input type=text id=txt name=txt onblur="replace(this.value)">
您可能感兴趣的文章: