📄 default.aspx
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function FillData()
{
var city=document.getElementById("TextBox1").value;
<% =this.ClientScript.GetCallbackEventReference(this,"city","FillDll",null) %>;
}
function FillDll(strcity)
{
document.getElementById("DropDownList1").options.length=0;
var indexofcity;
var city;
//切割传递来的字符串
while(strcity.length>0)
{
//判断是否是最后一个字符串
indexofcity=strcity.indexOf(",");
if(indexofcity >0)
{
city=strcity.substring(0,indexofcity);
strcity=strcity.substring(indexofcity+1);
//填充下拉框
document.getElementById("DropDownList1").add(new Option(city,city));
}
else
{
// 如果是最后一个字符串
document.getElementById("DropDownList1").add(new Option(strcity,strcity));
break;
}
};
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="width: 504px; height: 151px">
<tr>
<td colspan="2" style="font-weight: bold; color: #3300ff; text-align: center">
使用回调技术实现局部刷新</td>
</tr>
<tr>
<td style="width: 135px">
输入城市名称</td>
<td style="width: 3px">
<asp:TextBox ID="TextBox1" runat="server" Width="233px"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 135px">
</td>
<td style="width: 3px">
<input id="Button1" style="width: 131px" type="button" value="查询" onclick="FillData()"/></td>
</tr>
<tr>
<td style="width: 135px">
选择区域列表</td>
<td style="width: 3px">
<asp:DropDownList ID="DropDownList1" runat="server" Width="237px">
</asp:DropDownList></td>
</tr>
</table>
</div>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -