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
>
查看全文
相关阅读:
ThreadPoolExecutor线程池和ProcessPoolExecutor进程池
canvas画一个时钟
js中一些注意点 ps不断更新中....
javascript文档节点
Go网络编程
Goroutine和Channel
Go单元测试
简单了解Go语言JSON包
Go的命令行参数
Go语言文件操作
原文地址:https://www.cnblogs.com/simhare/p/901797.html
最新文章
并发与高并发(十三)J.U.C之AQS
day4_函数简单介绍
day3_字典
day3_元组
day3_文件操作
day3_列表
day3_字符串常用方法
day2_jmeter断言
day2_webservice接口怎么测-SoapUI
day2_python基础
热门文章
day2_抓包-抓包工具Charles
RabbitMQ使用介绍—Hello World
redis的连接方式
redis缓存数据库Hash,list,set操作
缓存数据库介绍Redis
初识scrapy
下载安装scrapy
tornado和异步IO的基本简单流程原理
gevent 和twisted模块实现并发
python中的asyncio模块
Copyright © 2011-2022 走看看