從主頁面把tantousyaID,edaban,torihikisakiTantousyamei三個字段傳到參照子畫面。參照子畫面以這三個關鍵字爲檢索條件檢索出符合條件的記錄當把光標定在某條記錄上後點擊確定後即把選定的那條記錄的值回傳填充到主畫面相應項
//************************************************************
// 主畫面把參數值tantousyaID,edaban,torihikisakiTantousyamei傳給參照頁面
// author:zhenghy
// 2005/02/21
//*************************************************************
function doReference(){
var doc = window.document.forms[0];
var forcus_name = doc.focus_name.value;
switch (forcus_name){
case "tantousyaID"://假設光標定位在tantousyaID時有效,可據需要另設
var url = doc.context_path.value + "/contents/app/common/torihikisakitantosyasansyou/CMN080OL.jsp";
//參照頁面地址
//取得tantousyaID
var strtantousyaCD = doc.tantousyaID.value;
//取得edaban
var stredaban = doc.edaban.value;
////取得torihikisakiTantousyamei
var strtorihikisakiTantousyamei = doc.torihikisakiTantousyamei.value;
var array = new Array;//將主頁面取得的參數保存在一數組中
array["torihikisakiHeadCode"] = strtantousyaCD;
array["accountAdbanHead"] = stredaban;
array["tantoNameHead"] = strtorihikisakiTantousyamei;
//參照頁面屬性設置
var topis = (screen.height - 700) / 2;
var leftis = (screen.width - 300) / 2;
var option = "dialogLeft:" + leftis + "px;dialogTop:" + topis + "px;dialogHeight:600px;dialogWidth:600px;status:no;help:no;scroll:false;";
//從參照頁面取得相應值並置入主頁面的相應項中
var resDataArray = window.showModalDialog(url,array,option);
doc.torihikisakiCD.value = resDataArray["torihikisakiLineCode"];
doc.edaban.value = resDataArray["accountAdbanLine"];
doc.torihikisakiTantousyamei.value = resDataArray["tantoNameLine"];
}
}
// ************************************************************
// 參照頁面
// author: zhenghy
// 2005/02/19
// ************************************************************
function doUserLoad(){
//取得從主頁面傳來的數據並設到參照頁面的相應查詢條件中
var dataArray = window.dialogArguments;
var modalForm = window.document.forms[0];
if(modalForm.change_flag.value != "load"){
modalForm.torihikisakiHeadCode.value = dataArray["torihikisakiHeadCode"];
modalForm.accountAdbanHead.value = dataArray["accountAdbanHead"];
modalForm.tantoNameHead.value = dataArray["tantoNameHead"];
modalForm.change_flag.value = "load";
modalForm.submit();
}
}
// ************************************************************
// 選中查詢結果中某一項後所做的動作
// author: zhenghy
// 2005/02/19
// ************************************************************
function doSelect(){
var doc = window.document.forms[0];
var forcus_name = doc.focus_name.value;
switch (forcus_name){
case "torihikisakiLineCode":
//取得選中的torihikisakiLineCode
var strtorihikisakiLineCode = "doc." + "torihikisakiLineCode" + "[" + doc.list_start_index.value + "]" + ".value";
var torihikisakiLineCode = eval(strtorihikisakiLineCode);
//取得選中的accountAdbanLine
var straccountAdbanLine = "doc." + "accountAdbanLine" + "[" + doc.list_start_index.value + "]" + ".value";
var accountAdbanLine = eval(straccountAdbanLine);
//取得選中的tantoNameLine
var strtantoNameLine = "doc." + "tantoNameLine" + "[" + doc.list_start_index.value + "]" + ".value";
var tantoNameLine = eval(strtantoNameLine);
//把選中記錄的各項值保存在一數組中返回
var array = new Array;
array["torihikisakiLineCode"] = torihikisakiLineCode;
array["accountAdbanLine"] = accountAdbanLine;
array["tantoNameLine"] = tantoNameLine;
returnValue = array;
window.close();
break;
default:
alert("請選擇torihikisakiLineCode.");
}
}
}