• js中在dotnot中innerText与value的使用区别


    当在主窗口中:
      private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
      {
       
       
       if(e.Item.ItemType == ListItemType.Footer)
       {
        //id:DataGrid1__ctl8 name:DataGrid1:_ctl8
        //DataGrid1:_ctl8:InsertphBox
        String DataGridID = e.Item.ClientID.Replace("__",":_");//将id转换成name,以便js访问
        
        DataGridID=DataGridID+":";
        e.Item.Attributes.Add("ondblclick","SetItems(document,'"+DataGridID+"')");
       }
      }
    后台代码
    js代码:
       <!--
      function SetItems(obj,dgid)
      {
       //document.all.SalesItemBox.innerText=salesitems;
       var agree=confirm('提取代理商进货单信息/查询已入销售单?[确定/取消]');
       var i=document.getElementById('ThisidHid').value
    var i=document.getElementById('ThisidHid').innerText//是取不到ThisidHid对像的值的

       //alert("请首先选择医院客户1!"+i);
       if(i==""){
        alert("请首先选择医院客户!"+i);
        return;
       }
       var parm= new Array(obj,dgid);
       if (agree)
        window.showModalDialog('SelectStockItems.aspx',parm,"left=400, top=100, height=800, width= 600, status=no, resizable= no, scrollbars= yes, toolbar= no,location= no, menubar= no");
       else
        window.showModalDialog('SelectStockItems.aspx',parm,"left=400, top=100, height=800, width= 600, status=no, resizable= no, scrollbars= yes, toolbar= no,location= no, menubar= no");
        //alert('查询已入销售单');
      }
      //-->
      </script>

    [弹出窗口设置主窗口控件值]
       if (!IsPostBack)
       {//如果是回传,就将值传回去,应该回当双击treevie或点击确定后回返并关闭

        string strScript = @"<script>
          function Done()
           {  //为dg的footer设置值             
            // 获取参数传递的对象
            var parm = window.dialogArguments;
            var sale=document.getElementById('SalesItemBox').value;
            // 控制对象
            var retstr=sale.split(',');
            //hisid,hisname
            //设置单据汇总信息
            //parm.getElementById('Thospital').innerText=retstr[1];这里只能设置value,如果为innerText设置值,主窗口想引用时是取不到值的
            parm.getElementById('Thospital').value=retstr[1];
            parm.getElementById('ThisidHid').value=retstr[0];
                   
           window.close(); 
           } 
          </script>";
        
        if (!IsClientScriptBlockRegistered("clientScript"))
        {
         RegisterClientScriptBlock("clientScript", strScript);
        }
       }
    js取datagrid值
       <script>
       <!--
      function SetValues(object)
      {//如果字串中有,号,就把,转成#
       var salesitems=object.cells[1].innerText.replace(/\,/g,"#")+",";//hisid
       salesitems+=object.cells[2].innerText.replace(/\,/g,"#");//hisname
       document.all.SalesItemBox.innerText=salesitems;
      }
      //-->
      </script>

  • 相关阅读:
    java中金钱计算BigDecimal
    SpringBoot的学习二:整合Redis,JPA,Mybatis
    SpringBoot的学习一:入门篇
    Java基础回顾一
    golang 实现冒泡排序
    Go统计键盘输入随机字母的个数
    破解点触码的识别之第三方平台超级鹰的SDK(python3版本)
    RuntimeError: Failed to init API, possibly an invalid tessdata path: E:python36报错
    Django项目部署
    Django REST framework 的功能
  • 原文地址:https://www.cnblogs.com/hhq80/p/663208.html
Copyright © 2020-2023  润新知