87,904
社区成员
发帖
与我相关
我的任务
分享
需求是这样的:
function getpara()
{
var arr,s,dis;
arr=document.form1.text1.value
s=arr.split(">")
dis=s[1]
document.form1.text2.value=dis;
}
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%response.Buffer=true
response.Expires=0
Response.ContentType="text/xml"%>
<!--#include file="../conn/connready.asp"-->
<%
dim return,rule
rule=request.QueryString("id")
sql="select price_notax from item_price_list_lines where item_id="&rule
set rs=server.CreateObject("Adodb.recordset")
rs.open sql,conn,1,1
if not rs.eof then
rs.movelast
return=rs("price_notax")
else
return="1"
end if
rs.close
set rs=nothing
response.write(rule&return)
%>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../common/public_function.asp" -->
<!--#include file="../../common/menuinc.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript">
var xmlHttp;
var completeDiv;
var inputField;
var nameTable;
var nameTableBody;
var flag=false;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function setflag(){
flag = true;
}
function DisSelect()
{
if(flag==false)
document.getElementById("popup").style.display="none";
}
function initVars() {
inputField = document.getElementById("frmchangshang");
nameTable = document.getElementById("name_table");
completeDiv = document.getElementById("popup");
nameTableBody = document.getElementById("name_table_body");
document.getElementById("popup").style.display="block";
}
function findNames() {
initVars();
if (inputField.value.length > 0)
{
createXMLHttpRequest();
var url = "search1.asp?names=" + inputField.value;
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = callback;
xmlHttp.send(null);
}
else
{
clearNames();
}
}
function callback() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200)
{
try
{
var name = xmlHttp.responseXML.getElementsByTagName("name")[0].firstChild.data;
var userid = xmlHttp.responseXML.getElementsByTagName("userid")[0].firstChild.data;
}
catch(e)
{
document.getElementById("popup").style.display="none";
clearNames();
}
setNames(xmlHttp.responseXML.getElementsByTagName("content"));
}
else if (xmlHttp.status == 204)
{
clearNames();
}
}
}
function setNames(the_names) {
clearNames();
var size = the_names.length;
setOffsets();
var row,cell,spans;
for (var i = 0; i < size; i++) {
//var nextNode = the_names[i].firstChild.data;
var e = the_names[i];
//取得子节点内容,重新装载为数组
var nextNode=e.getElementsByTagName("name")[0].firstChild.data;
//创建tr,td,span元素
row =document.createElement("tr");
cell =document.createElement("td");
//spans=document.createElement("span");
//设置cell属性
cell.onmouseout = function() {this.className='mouseOver'; flag=false;};
cell.onmouseover = function() {this.className='mouseOut'; flag=true;};
cell.setAttribute("bgcolor","#FFFAFA");
cell.setAttribute("border","0");
//cell.setAttribute("onmouseover","setflag()");
cell.onclick = function() { populateName(this); };
//将nextNode添加到td
var txtName = document.createTextNode(nextNode);
cell.appendChild(txtName);
//装载隐藏数据到span元素
row.appendChild(cell);
nameTableBody.appendChild(row);
}
}
function setOffsets() {
var end = inputField.offsetWidth;
var left = calculateOffsetLeft(inputField);
var top = calculateOffsetTop(inputField) + inputField.offsetHeight;
completeDiv.style.border = "black 1px solid";
completeDiv.style.left = left + "px";
completeDiv.style.top = top + "px";
nameTable.style.width="400px";
}
function calculateOffsetLeft(field) {
return calculateOffset(field, "offsetLeft");
}
function calculateOffsetTop(field) {
return calculateOffset(field, "offsetTop");
}
function calculateOffset(field, attr) {
var offset = 0;
while(field) {
offset += field[attr];
field = field.offsetParent;
}
return offset;
}
function populateName(cell) {
//填充数据到web页面,cell---->td对象
inputField.value = cell.firstChild.nodeValue;
clearNames();
}
//清除列表数组
function clearNames() {
var ind = nameTableBody.childNodes.length;
for (var i = ind - 1; i >= 0 ; i--) {
nameTableBody.removeChild(nameTableBody.childNodes[i]);
}
completeDiv.style.border = "none";
}
function getpara(){
with(document.form1){
if(frmchangshang.value.length==0){return;}
test.value=frmchangshang.value.split(">")[1];
var id=test.value;
}
//ajax
var x=createXMLHTTP();
var url='Ajaxcode.asp?id='+id+'&s='+ new Date().getTime();
x.open('GET',url,true)
x.onreadychange=homel(x);
x.send(null)
}
function homel(x){
if (x.readyState==4){
if(x.status==200||x.status==0){
var s=x.responseText;
document.form1.test.value=s;
x=null;
}
}
}
</script>
</head>
<body>
<form name="form1">
<input name="frmchangshang" class="txtBoxStyle2" id="frmchangshang" style="width:400px;" onBlur="DisSelect();" onKeyUp="findNames();" size="50" maxlength="150" value="<%=items%>" onClick="getpara()">提示:输入关键字,程序自动从库中匹配您要找的记录,如果不存在自行填写</span> </span>
<div style="position:absolute;top:0;left:0;" id="popup">
<table id="name_table" bgcolor="#FFFAFA" border="0" cellspacing="0" cellpadding="0">
<tbody id="name_table_body"></tbody>
</table>
</div>
<input type="text" name="test" id="test">
</form>
</body>
</html>
function creatXMLHTTP(){
var xmlHttp=null;
try{xmlHttp=new XMLHttpRequest();}
catch (MSIEx){
try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){
try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){alert('您的浏览器不支持AJAX!');}
}
}
return xmlHttp;
}
function getpara(){
with(document.form1){
if(text1.value.length==0){return;}
text2.value=text1.value.split(">")[0];
var id=text2.value;
}
//ajax
var x=createXMLHTTP();
var url='你的后台处理文件.asp?id='+id+'&s='+ new Date().getTime();
x.open('GET',url,true)
x.onreadychange=homel(x);
x.send(null)
}
function homel(x){
if (x.readyState==4){
if(x.status==200||x.status==0){
var s=x.responseText;
//处理你的返回数据。。。。。
x=null;
}
}
}