javascript在頁面間資料轉送的使用
來源:互聯網
上載者:User
資料|頁面 功能描述:從首頁面把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.");}}}