医药CRM系统开发

自已做医药CRM系统有四年了,终于可以算个产品了,努力市场化,今年重种将医药营销的理念加入CRM

导航

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

Posted on 2007-03-04 08:28  hhq80  阅读(589)  评论(0编辑  收藏  举报

当在主窗口中:
  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>