日期:2014-05-18  浏览次数:20492 次

服务器控件解析为html控件后,onclick事件调用js函数居然会刷新页面。
<%@   Page   Language= "C# "   AutoEventWireup= "true "   CodeBehind= "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>
        <style   type= "text/css ">
                #EmployeeSort   {
                        width:100px;
                }
                #EmployeeBox   {
                        float:left;
                  }

                #EmployeeOperate   {
                        float:right;
                        vertical-align:   middle;
                  }
        </style>
      <script   language= "JavaScript "   type= "text/javascript ">
        //listbox中item项交换位置
        function   changepos(obj,index)
        {
                if(index   ==   -1)
                {
                        if   (obj.selectedIndex   >   0)
                        {
                                obj.options(obj.selectedIndex).swapNode(obj.options(obj.selectedIndex-1))

                        }
                }
                else   if(index   ==   1)
                {
                        if   (obj.selectedIndex <obj.options.length-1)
                        {
                                obj.options(obj.selectedIndex).swapNode(obj.options(obj.selectedIndex+1))
                        }
                }
                var   t   =   obj.selectedIndex;
                if