js调用后台初始原来的数据,并且可以出示为特定的值,此处为“河南省”
<script type="text/javascript">
function show()
{
set_school_pos('河南省','<%=ClassCity%>','<%=ClassArea%>')
}
</script>
function show()
{
set_school_pos('河南省','<%=ClassCity%>','<%=ClassArea%>')
}
</script>
html主要代码如下:
<head>
<script type="text/javascript" src="/js/city/regions.js" charset="gb2312"></script>
<script type="text/javascript" src="/js/city/school_register.js"></script>
</head>
<body onload="show()" >
<form id="form1" name="form1" runat="server">
<select name="sch_province" onChange="javascript:set_school_pos(this.value);">
<option value="">省份</option>
</select>
<select name="sch_capital" onChange="javascript:set_school_pos(document.form1.sch_province.value,this.value);">
<option value="">地级市</option>
</select>
<select name="sch_city">
<option value="">市、县级市、县</option>
</select>
</frome></body>
后台代码:
private ClassSkyClass _ClassSkyClass=new ClassSkyClass();
public string ClassCity
{ get { return _ClassSkyClass.City; } }
public string ClassArea
{ get { return _ClassSkyClass.Area; } }
代码中用到的js地址:school_register.js,regions.js
public string ClassCity
{ get { return _ClassSkyClass.City; } }
public string ClassArea
{ get { return _ClassSkyClass.Area; } }