📄 webform1.aspx
字号:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="dropdown.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<SCRIPT language="javascript">
function cityresult()
{
var mobile_Models=document.getElementById("Brand1").options[document.getElementById("Brand1").selectedIndex].value;
dropdown.AjaxMethod.GetCityList(mobile_Models,get_mobile_Models_Result_CallBack);
}
function get_mobile_Models_Result_CallBack(request)
{
if(request.value !=null)
{
document.all("Models").length=0;
var ds=request.value;
if(ds !=null && typeof(ds) == "object" && ds.Tables !=null)
{
for(var i=0;i<ds.Tables[0].Rows.length;i++)
{
var name=ds.Tables[0].Rows[i].city;
var id=ds.Tables[0].Rows[i].id;
document.all("Models").options.add(new Option(name,id));
}
}
}document.getElementById("txtcity").value = document.getElementById("Models").options[0].text;
return
}
function change()
{
var mobile_Models=document.getElementById("Models").options[document.getElementById("Models").selectedIndex].innerText;
document.getElementById("txtcity").value = mobile_Models;
}
</SCRIPT>
</HEAD>
<body MS_POSITIONING="GridLayout" onload="cityresult();">
<form id="Form1" method="post" runat="server">
<div><asp:dropdownlist id="Brand1" runat="server"></asp:dropdownlist><asp:dropdownlist id="Models" runat="server" onchange="change()">
<asp:ListItem Value=" 城市"> 城市</asp:ListItem>
</asp:dropdownlist><asp:button id="Button2" runat="server" Text="查看"></asp:button><asp:textbox id="txtcity" style="Z-INDEX: 101; LEFT: 272px; POSITION: absolute; TOP: 120px" runat="server"></asp:textbox></div>
</form>
</body>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -