var StudentSGUID = $("ListBoxStudent").value;
     var StudentIndex = $("ListBoxStudent").selectedIndex;
     var SubjectIndex = $("ListBoxSubject").selectedIndex;
     Callback1.Callback(StudentSGUID,StudentIndex,SubjectIndex);
    
    if (SubjectIndex != $("ListBoxSubject").length - 1)
    {
        $("ListBoxSubject").selectedIndex = eval(SubjectIndex) + 1 ;
        //$("ListBoxSubject").focus();
        document.getElementById("ListBoxSubject").focus();
    }
    else
    {
        $("ListBoxStudent").selectedIndex = eval(StudentIndex) + 1;
        //$("ListBoxStudent").focus();
          document.getElementById("ListBoxStudent").focus();
     }

解决方案 »

  1.   

    $("ListBoxStudent")你这个取得到值吗?
    一般都是用$("#ListBoxStudent")取值把
      

  2.   

    SetFocus 只能在 PreRender 之前和之中调用 调用focus时出现这个上述错误  == !
      

  3.   

     protected void Button1_ServerClick(object sender, EventArgs e)
        {
            string lpSGUID = this.TextBoxSGUID.Value;
            string sImageURL = Server.MapPath("~/Temp/" + lpSGUID + ".JPG");
            File.Delete(sImageURL);
            if (this.FileUpload1.FileName != "")
            {
                try
                {
                    this.FileUpload1.SaveAs(sImageURL);
                    this.Image1.ImageUrl = "~/Temp/" + lpSGUID + ".JPG";
                    this.ImageURL.Value = sImageURL;
                }
                catch
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Cscript", "<script for=window event=onload>window.alert('图片文件上传失败!');</script>");
                    return;
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Cscript", "<script for=window event=onload>window.alert('请先选择图片文件!');</script>");
                return;
            }
        }      
    图片怎么查看不出来 求高手!!!
      

  4.   

    var myObject=document.getElementById("<%= ListBoxStudent.ClientID %>");//取得Web控件
      

  5.   

    this.Image1.ImageUrl = "~/Temp/" + lpSGUID + ".JPG";
    换成
    this.Image1.ImageUrl = sImageURL;
      

  6.   

    #likevs# 灰常感谢你 图片显示问题搞定
      

  7.   

    var myObject=document.getElementById("<%= ListBoxStudent.ClientID %>");//取得Web控件
    我这样取值 
     var StudentSGUID = $("ListBoxStudent").value;
         var StudentIndex = $("ListBoxStudent").selectedIndex;     var SubjectIndex = $("ListBoxSubject").selectedIndex;
    //     var StudentIndex=document.getElementById("<%= ListBoxStudent.ClientID %>").selectedIndex;//
    //     alert(StudentIndex);
    //     var SubjectIndex=document.getElementById("<%= ListBoxSubject.ClientID %>").selectedIndex;//
        
        
        if (SubjectIndex != $("ListBoxSubject").length -1 )
        {      
            //$("ListBoxSubject").focus();
            document.getElementById("<%= ListBoxStudent.ClientID %>").focus();
            $("ListBoxSubject").selectedIndex = eval(SubjectIndex) + 1 ;
        }
        else
        {
            //$("ListBoxStudent").focus();
            document.getElementById("<%= ListBoxStudent.ClientID %>").focus();
            $("ListBoxStudent").selectedIndex = eval(StudentIndex) + 1;
            //$("ListBoxSubject").selectedIndex = 0;
         }
         
          Callback1.Callback(StudentSGUID,StudentIndex,SubjectIndex);
      

  8.   

    取得Web控件 统一用这种方法吗
      

  9.   

    是的,因为Web控件在生成时,会按一定算法生成客户端ID的
      

  10.   

    哦对了,如果你实在不想用我的方式获取Web控件ID,那也行,你直接运行页面,然后右键-》查看网页源文件,找到相应的控件位置的HTML代码,查一下那个控制最终的ID,你直接用这个ID也能JS获取得到,因为它才是最终生成的ID号