asp查询xml的代码,实现了无刷新、模糊查询功能
来源:互联网 发布:斗罗大陆3单机数据修改 编辑:程序博客网 时间:2024/06/05 17:19
<html>
<head>
<title>不刷新页面查询的方法</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<script language="javascript">
<!--初始化,将数据岛中数据装入列表框中-->
function loadinsel()
{
var employeeid,employeelastname; //分别存放雇员ID和雇员名字
root=document.all.xmlemployees.childNodes.item(0); //返回第一个元素--employee
for(i=0;i<root.childNodes.length;i++){
getnode=root.childNodes(i); //得到empolyee的一个子节点
employeeid=root.childNodes(i).getAttribute("emid");//得到雇员ID
for(j=0;j<getnode.childNodes.length;j++){
employeeinf=getnode.childNodes(j).nodeName;
if(employeeinf=="lastname"){
employeelastname=getnode.childNodes(j).text; //得到雇员名字
}
}
//将得到的employeeid和employeelastname写进select中
if(employeeid!="" && employeelastname!=""){
option1=document.createElement("option");
option1.text=employeelastname;
option1.value=employeeid;
employeelist.add(option1);
}
}
}
<!--初始化,从数据岛中检索数据,装入列表框中-->
function findemployee(){
var employeelastname,employeeid; //分别存放雇员名字和雇员ID
employeelastname="";
employeeid="";
findtext=window.findcontent.value; //得到检索条件
//清除列表框
employeecount=employeelist.length
for(i=employeecount-1;i>=0;i--){
employeelist.remove(i);
}
root=window.xmlemployees.childNodes(0);
for(i=0;i<root.childNodes.length;i++){
getitem=root.childNodes(i); //得到empolyee的一个子节点
employeeid=root.childNodes(i).getAttribute("emid"); //得到雇员ID
for(j=0;j<getitem.childNodes.length;j++){
if(getitem.childNodes(j).nodeName=="lastname"){
employee_temp=getitem.childNodes(j).text;
if(employee_temp.indexOf(findtext)!=-1){ //查找匹配项
employeelastname=employee_temp; //找到名字匹配的雇员
}
}
}
//将符合条件的雇员信息写进select中
if(employeeid!="" && employeelastname!=""){
option1=document.createElement("option");
option1.value=employeeid;
option1.text=employeelastname;
window.employeelist.add(option1);
employeeid="";
employeelastname="";
}
}
}
</script>
<body bgcolor="#FFFFFF" text="#000000" onload="javascript :loadinsel()">
<table width="80%" border="1">
<tr>
<td> 请输入查询条件:
<input type="text" name="findcontent">
<input type="button" name="Submit" value="查找" onclick="javascript :findemployee()">
</td>
</tr>
<tr>
<td> 查询结果:
<select name="employeelist">
</select>
</td>
</tr>
</table>
<?xml version="1.0" encoding="gb2312"?>
<%
servername="wyb" '服务器名
user="sa" '用户名
pw="" '用户密码
databasename="northwind" '数据库名
set conn=server.CreateObject("adodb.connection")
conn.Open "DRIVER=SQL Server;SERVER="&servername&";UID="&user&";pwd="&pw&";DATABASE="&databasename
set rs=server.CreateObject("adodb.recordset")
sql="Select employeeid,lastname from employees order by employeeid"
rs.Open sql,conn%>
<!--将数据库中信息放入数据岛中-->
<xml id="xmlemployees">
<employee>
<%do while not rs.eof%>
<employeeitem emid="<%=rs("employeeid")%>">
<lastname><%=rs("lastname")%></lastname>
</employeeitem>
<%rs.movenext%>
<%loop%>
</employee> </xml>
<%rs.close
set rs=nothing
%>
</body>
</html>
- 一段asp查询xml的代码,实现了无刷新查询,模糊查询功能。
- asp查询xml的代码,实现了无刷新、模糊查询功能
- C# xml模糊查询的实现
- 对xml 模糊查询 代码
- 用Criteria进行模糊查询实现简单的搜索功能
- 用Criteria进行模糊查询实现简单的站内搜索功能
- jquery实现下拉选的模糊查询功能
- ASP.NET利用存储过程实现模糊查询的心得
- asp.net+SQL2005实现字符串的模糊查询
- C# Combobox控件实现模糊查询功能
- 使用jQuery实现实时模糊查询功能
- bootstrap typeahead实现模糊查询功能
- 实现模糊查询的方法
- Oracle模糊查询的实现
- jQuery实现的模糊查询
- asp.net中用dropdownList实现查询功能代码
- 代码实现模糊查询(正则实现),比如在多表查询的情况下“
- 关于xml的模糊查询问题
- vs2005安装使用指南
- 安装 WebSphere应用服务器
- J2EE MVC模式JSF与Struts的异同
- 将指定的asp文件内容生成HTML文件
- 售前工程师与售后工程师
- asp查询xml的代码,实现了无刷新、模糊查询功能
- 逛街
- 一步一步学JSP(环境配置,数据库连接,web应用配置)
- JSP的环境引擎--websphere
- Chap 4 学习笔记-使用C#存储变量数据
- 在struts中使用validator
- 男人25岁前的忠告
- 从来没有真正的写过blog
- RSS文档