zoukankan
html css js c++ java
ajax/应用1
//
init_xmlhttp函数会根据不同的浏览器初始化xmlhttp对象
function
init_xmlhttp()
{
var
A
=
null
;
try
{
A
=
new
ActiveXObject(
"
Msxml2.XMLHTTP
"
);
//
IE
}
catch
(e)
{
try
{
A
=
new
ActiveXObject(
"
Microsoft.XMLHTTP
"
);
//
非IE
}
catch
(oc)
{
A
=
null
}
}
if
(
!
A
&&
typeof
XMLHttpRequest
!=
"
undefined
"
)
{
A
=
new
XMLHttpRequest()
}
return
A
}
function
Go(obj)
{
var
var1
=
document.form1.ddl_1[document.form1.ddl_1.selectedIndex].value;
if
((var1
==
"
7
"
)
||
(var1
==
"
5
"
))
//
5核销人 7 支付方式
{
//
得到选择框的下拉列表的value
var
svalue
=
obj.value;
//
alert(svalue);return false;
//
定义要处理数据的页面
var
weburl
=
"
select_data_ysfhxcx.aspx?list_item_value=
"
+
svalue;
//
初始化个xmlhttp对象
var
xmlhttp
=
init_xmlhttp();
//
去weburl获取数据,第一个参数最好为get,第三个参数最好为true
xmlhttp.open(
"
get
"
,weburl,
true
);
//
alert("a"); return false;//执行了
xmlhttp.onreadystatechange
=
function
()
{
//
alert(xmlhttp.readyState); return false;//这时接到的值为1,不知是什么意思,可能表示开始执行,在select_data_ysdzd.aspx中就能断到断点
if
(xmlhttp.readyState
==
4
)
//
4代表成功返回数据
{
var
result
=
xmlhttp.responseText;
//
得到服务器返回的数据
document.getElementById(
"
txt_of_pnl1
"
).style.display
=
"
none
"
;
document.getElementById(
"
ddl_of_pnl1
"
).style.display
=
""
;
document.getElementById(
"
ddl_of_pnl1
"
).length
=
0
;
document.getElementById(
"
ddl_of_pnl1
"
).options.add(
new
Option(
"
"
,
"
"
));
if
(result
!=
""
)
//
如果返回的数据不是空
{
//
alert(result);return false;
var
allArray
=
result.split(
"
,
"
);
//
循环这个数组,注意是从1开始,因为收到的字符串第一个字符是,号,所以分割后第一个数组为空
for
(
var
i
=
1
;i
<
allArray.length;i
++
)
{
var
thisArray
=
allArray[i].split(
"
|
"
);
document.getElementById(
"
ddl_of_pnl1
"
).options.add(
new
Option(thisArray[
0
].toString(),thisArray[
1
].toString()));
}
}
else
{
document.getElementById(
"
ddl_of_pnl1
"
).length
=
0
;
}
}
}
xmlhttp.send(
null
);
//
没有这句,根本进不到select_data_ysdzd.aspx页面!!!!!
}
//
if((var1 == "7")||(var1 == "5")) End
else
{
document.getElementById(
"
txt_of_pnl1
"
).style.display
=
""
;
document.getElementById(
"
ddl_of_pnl1
"
).style.display
=
"
none
"
;
}
}
CS:
ddl_1.Attributes.Add(
"
onchange
"
,
"
Go(this)
"
);
//
最左边的按钮"各种检索条件"
this
.ddl_of_pnl1.Attributes.Add(
"
onchange
"
,
"
javascript:document.form1.hid_ddl_right.value=this.value;
"
);
//
右边panel中的DDL
HTML:
<
td
>
<
asp:DropDownList
ID
="ddl_1"
runat
="server"
Width
="140px"
>
<
asp:ListItem
Text
=""
Value
="0"
></
asp:ListItem
>
<
asp:ListItem
Text
="编号"
Value
="1"
></
asp:ListItem
>
<
asp:ListItem
Text
="单号"
Value
="2"
></
asp:ListItem
>
<
asp:ListItem
Text
="凭证号"
Value
="3"
></
asp:ListItem
>
<
asp:ListItem
Text
="支票号"
Value
="4"
></
asp:ListItem
>
<
asp:ListItem
Text
="核销人"
Value
="5"
></
asp:ListItem
>
<
asp:ListItem
Text
="涉帐单位"
Value
="6"
></
asp:ListItem
>
<
asp:ListItem
Text
="支付方式"
Value
="7"
></
asp:ListItem
>
</
asp:DropDownList
>
</
td
>
<
td
>
<
asp:Panel
ID
="pnl1"
runat
="server"
Width
="100px"
>
<
asp:TextBox
ID
="txt_of_pnl1"
runat
="server"
Width
="140px"
CssClass
="input_text"
></
asp:TextBox
>
<
asp:DropDownList
ID
="ddl_of_pnl1"
style
="display:none;"
runat
="server"
Width
="140px"
>
</
asp:DropDownList
>
</
asp:Panel
>
</
td
>
查看全文
相关阅读:
PHP 支付类库, cURL开源HTTP类库
sublime text3 批量查找替换文件夹或项目中的字符
php 腾讯云 对象存储V5版本 获取返回的上传文件的链接方法
Redis Desktop Manager 利用ssh连接 Redis
一键PHP/JAVA安装工具 OneinStack
函数之局部变量和使用global语句
函数之定义形参
函数之定义函数
大数据入门第二十天——scala入门(二)scala基础02
大数据入门第二十天——scala入门(二)scala基础01
原文地址:https://www.cnblogs.com/simhare/p/901797.html
最新文章
[傅里叶变换及其应用学习笔记] 一. 预备知识
[Android] 混音器AudioMixer
[Android] 混音线程MixerThread
navicat mysql导出数据 批量插入的形式
Linux 搭建安装Maven环境
jQuery输入框回车添加标签特效
linux git 报错提示 fatal: 'origin' does not appear to be a git repository 解决办法
在win10下安装eclipse
PHP实现的自定义图像居中裁剪函数示例
PHP图片裁剪与缩放示例(无损裁剪图片)
热门文章
MySQL按指定字段自定义列表排序
高德地图JS API获取经纬度,根据经纬度获取城市
php脚本#!/usr/bin/env php写法的好处
PHP 图片缩放类
FileReader 获取图片base64数据流 并 生成图片
php 网页版 ftp 小工具
php canvas 前端JS压缩,获取图片二进制流数据并上传
php 接收blob数据流,base64数据流 转为 blob二进制数据流
腾讯云 网站开启HTTPS
在static的function静态函数中访问成员变量
Copyright © 2011-2022 走看看