现在的位置: 首页 > 综合 > 正文

网站常用的table操作js

2012年05月02日 ⁄ 综合 ⁄ 共 2871字 ⁄ 字号 评论关闭

1.frames之间值传递:

    function DdlChangeId_Onhanged(obj) {
       
        var ff = document.forms[0];
      
        //得到所有的frame
        var objFrames = parent.frames;
        var ChangeValue = obj.value;

        //得到框架一的,一个文本框
        var obj_jan = objFrames[0].document.getElementById("SaleInputArea1_TxtInputJanId");
  
       
        if(ChangeValue!=""){
        //设置另一个框架里的文本框为可写
            obj_jan.readOnly = false;
        //设置该文本框的style的class
            obj_jan.className = "TextBox0W";
            obj_jan.value="";
           
        //设置当前的框架的按钮可用。
            ff.BtnInput.disabled = false;     // 登録
        }
        else
        {        
           
            obj_jan.className = "TextBox0R";
            obj_jan.readOnly  = true;
           
     ff.BtnInput.disabled = true;     // 登録
        }
    } 
 2.table
/*
  *双击选定的行调用的函数,并把选定行的一些数据填充到令一个fram的文本框里
          RowObj:table的行对象
          RowIndex:行号
*/ 

  function GridRowdblClick(RowObj,RowIndex)
  {
        var objFrames  = parent.frames;
        var obj_jan    = objFrames[0].document.getElementById("SaleInputArea1_TxtInputJanId");
        var obj_mac    = objFrames[0].document.getElementById("SaleInputArea1_TxtMac");
 var obj_xian   = objFrames[0].document.getElementById("SaleInputArea1_TxtXian");
      
        var ff = document.forms[0];
        var rtnValue = "";
        var rtnArray = new Array();
       
     obj_jan.readOnly  = true;
     obj_jan.className = "TextBox0R";
     obj_jan.value=RowObj.cells[1].innerHTML;//cells的下标从零开始
    
     obj_mac.readOnly  = true;
     obj_mac.className = "TextBox0R";
     obj_mac.value=RowObj.cells[2].innerHTML;
    
    
    
     // 通过后台ajax获取详细信息(db操作)
     rtnValue = GetReturnGoodsDetail(RowObj.cells[0].innerHTML);
    
     if (rtnValue != "")
     {
         obj_xian.value=rtnValue   
        
     }
    
     GridRowOnMouseSelected(RowObj,RowIndex);  // 记录选中的行,并设置其样式
    
    
    
  }
 /*
         *鼠标离开选中行时的事件
 */
function GridRowOnMouseSelected(rowObj,RowIndex)
{  //得到table对象
   
  var ParentObj = rowObj.parentNode;
   
    //alert(ParentObj.innerHTML);
   
      if (SelectedRowId >= 0)
         {
     ParentObj.rows[SelectedRowId].className = "GridOnmouseOut";
  }
 
 rowObj.className = "GridOnmouseSelected";//行的class
 SelectedRowId    = parseInt(RowIndex,10) + 1;
}
    
 3.键盘监听事件
 window.document.onkeydown = inpCodeToForm2; 
flagF01 = true;
flagF02 = true;
//バーコードスキャン時の動作
function inpCodeToForm() {
    if (parent.Kaiten_Center.document.getElementById("Kyousei")) {
      //入庫処理の場合
        if (flagF02) {
            if (event.keyCode == "115") {
                killEvent();
                parent.Kaiten_Center.document.getElementById('InpJAN').focus();
            }
        } else {
            if (event.keyCode == "115") {
                killEvent();
            }
        }           
    } else {
        //受付表発行の場合
        if (flagF01) {
            if (event.keyCode == "115") {
                killEvent();
                parent.Kaiten_Left.document.getElementById('InpJAN').focus();
            }
        } else {
            if (event.keyCode == "115") {
                killEvent();
            }
        }
    }
}
   
  

抱歉!评论已关闭.