昨晚中国站长天空网论坛的版主peak发了一页代码给我,是一个服务器控件与客户端脚本关联的例子,是关于服务器控件与客户端脚本之间的交互和传递消息。当我们既然用到服务器控件,但同时又要减轻服务器的负担,提高执行效率时,我们可以把该控件的一些不大重要的可附加的功能,比如验证,放在客户端来进行。这不失为一个好方法。

     这页代码是peak发给我的,没跟他打招呼就放了上来,请见谅!

    下面看代码:

  <%@ Page Language="VB" AutoEventWireup="false" CodeFile="temp10-8.aspx.vb" Inherits="temp10_8" %>

<!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>


</head>
<body>
<form id="myform" runat="server">

测试页面,用于测试gridview的回传标记<br />

<script language=javascript>
function mmm() {
document.myform.DropDownList1.length = 0; //将下拉框先清空
document.myform.DropDownList1.options[0] = new Option('==请选择==','');
}
</script>

<asp:DropDownList ID="DropDownList3" runat="server" onchange="mmm()">
<asp:ListItem>=请选择=</asp:ListItem>
<asp:ListItem Value="广东">广东</asp:ListItem>
<asp:ListItem Value="广西">广西</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList id="DropDownList1" runat="server" >
</asp:DropDownList>


</form>
</body>
</html>
http://yeah888.blog.sohu.com/19132196.html

posted on 2007-01-22 11:44  mbskys  阅读(138)  评论(0)    收藏  举报