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
>
查看全文
相关阅读:
7、【Linux系统编程】阻塞和非阻塞
css样式
如果目录不存在就创建
api图片传输,转成64位字符串进行传输
c#获取远程图片的方法
分页
使用微信js接口的方法 ,以调用相机为例
某个文件下下面的文件批量改名
查找本地文件中的特定字符串并替换代码
第35月第6天 自定义view初始化
原文地址:https://www.cnblogs.com/simhare/p/901797.html
最新文章
怎么运行jsp文件
硬盘电路板故障的数据恢复方法分析
硬盘掉线导致服务器崩溃数据恢复方案
数据恢复经典案例分析:阵列两块硬盘离线数据恢复
RAID5数据恢复原理和阵列数据恢复案例
raid阵列中有两块硬盘存在大量坏道的恢复数据过程
硬盘开盘数据恢复案例两则+硬盘开盘小提示
光纤存储2块硬盘掉线数据恢复过程
MongoDB数据库文件损坏恢复案例
虚拟机数据恢复方法-FreeNAS+ESXi5数据恢复
热门文章
PS6100存储硬盘坏道数据恢复案例-存储数据恢复方法
15、【C++基础】存储类
4、python入门-语句
3、python入门-变量
3、Ubuntu14.04安装codelite codeblocks wxWidgets atom git vim 搜狗 WPS
2、python入门-工具选择
12、【Linux系统编程】access函数
11、【Linux系统编程】ioctl函数
9、【Linux系统编程】fcntl函数
10、【Linux系统编程】lseek函数
Copyright © 2011-2022 走看看