返回按钮的做法 js获取ur与下拉框的值l跳转与c#跳转

// 得到指定ddl的选项值
        function getDdlSelectValue(ddlobj)
        {
            
try
            {
                
return  ddlobj.options[ddlobj.selectedIndex].value            
            }
            
catch (e)
            {
                
return   "" ;
            }
        }
        function getDdlSelectText(ddlobj)
        {
            
try
            {
                
return  ddlobj.options[ddlobj.selectedIndex].text            
            }
            
catch (e)
            {
                
return   "" ;
            }
        }
        
        function goTo()
        {
            var dll 
=  document.getElementById( " DDlTitle " );
            var selectText 
=  getDdlSelectText(dll);
            var select 
=  getDdlSelectValue(dll);            
            var url 
=   " /Manager/Article/PageContent.aspx? ShowType = " +select+ " & Type = P & Kind = " +selectText+ " & url = " +escape(window.location.href); //得到当前页面的url
            window.location.href  =  url;

        }

js:window.location.href放在=左边得到当前页面地址,放在右边则为转向。

c#:string url = Request.RawUrl.ToLower();//得到当前页面的url

Response.Redirect("PageContent.aspx?ShowType="+this.DDlTitle.SelectedValue+"&Type=N&Kind="+DDlTitle.SelectedItem.Text+"&url="+url+"&Id="+DDlClassId.SelectedValue);


你可能感兴趣的:(下拉框)