您的位置:首页 > 运维架构 > 网站架构

网站常用的table操作js

2008-03-26 11:34 459 查看
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();

}

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: