<script type="text/javascript" language="javascript">
    function checkData() {
            var dropleixing = document.getElementById('<%=dropleixing.ClientID%>').value;
            var dropbanbene=document.getElementById('<%=dropbanben.ClientID%>').value;            if (confirm("你确实要删除" + dropleixing + "的第"+dropbanbene+"版吗?")) {
                return true;
            }
            else {
                event.returnValue = false;
                return false;
            }
        }
    </script>dropleixing控件的text是中文,比如:教育类,value是1,我现在想让“你确实要删除" + dropleixing + "的第"+dropbanbene+"版吗?”中的dropleixing显示dropleixing控件的text值,怎办?

解决方案 »

  1.   


    <script type="text/javascript" language="javascript"> 
     function checkData() { 
    var dropleixing = document.getElementById(' <%=dropleixing.ClientID%>');
    var dropleixingText=dropleixing.options[dropleixing.selectedIndex].text;
    var dropbanbene=document.getElementById(' <%=dropbanben.ClientID%>').value;             if (confirm("你确实要删除" + dropleixingText+ "的第"+dropbanbene+"版吗?")) { 
                    return true; 
                } 
                else { 
                    
                    return false; 
                } 
    }
    </script> 
      

  2.   

    document.getElementById("DropDownList1").options[document.getElementById("DropDownList1").selectedIndex].text
    document.getElementById("DropDownList1").value 
      

  3.   

    请问,textbox控件和FileUpload控件,在JS中怎么判断他的内容是否为空?
      

  4.   


    var txtValue=document.getElementById(' <%=TextBoxID.ClientID%>').value;
    txtValue=txtValue.replace(/(^s*)|(s*$)/g, ""); //相当于Trim()函数
    if(txtValue!='')
    {
       // 不为空
    }
    FileUpload 同样