Ajax 通過id 擷取名字 以及 所屬班級

來源:互聯網
上載者:User

<%@ page contentType="text/html;charset=gb2312" %>
<script language="JavaScript">
<!--

var xmlHttp;

 

function createXMLHttpRequest() {

    if (window.ActiveXObject) {

        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

    }

    else if (window.XMLHttpRequest) {

        xmlHttp = new XMLHttpRequest();

    }

}

 

function queryUserInfo() {

    var jrntl_id = document.getElementById("jrntl_id").value;
 
    if(jrntl_id == "") {
        return;
    }

 

    var url = "../jsp/gywork/getInfo.jsp?userId="+jrntl_id;

 

    createXMLHttpRequest();

    xmlHttp.onreadystatechange = handleAddStateChange;

    xmlHttp.open("GET", url, true);

    xmlHttp.send(null);

}

function handleAddStateChange() {

    if(xmlHttp.readyState == 4) {

        if(xmlHttp.status == 200) {

            var responseXML = xmlHttp.responseXML;
     var queryResult = responseXML.getElementsByTagName("queryResult")[0].firstChild.nodeValue;

     if("failed"== queryResult){

     }else{
  var name =  responseXML.getElementsByTagName("name")[0].firstChild.nodeValue;
  var bank_id = responseXML.getElementsByTagName("bank_id")[0].firstChild.nodeValue;
  var bank_name = responseXML.getElementsByTagName("bank_name")[0].firstChild.nodeValue;
  document.getElementById("counter_name").value = name;
  document.getElementById("jrnbr").value = bank_id;
  document.getElementById("jrnbr_name").value = bank_name;

     }

        }

        else {

            alert("進行後台資料擷取發生錯誤!");

        }

    }

}

 

 function getjrnac_dat(){
 var val = showModalDialog("../report/Calendar.htm",window,"status:no;dialogWidth:250px;dialogHeight:250px");
  if(typeof(val)!="undefined")
     document.handaddfrm.jrnac_dat.value=val;
 }
 function getadd_date(){
 var val = showModalDialog("../report/Calendar.htm",window,"status:no;dialogWidth:250px;dialogHeight:250px");
  if(typeof(val)!="undefined")
     document.handaddfrm.add_date.value=val;
 }
function interOnSubmit(){
 var alerttext="";
 var flag = false;
 if(!isStringLong(document.getElementsByName('jrntl_id')[0].value,4)){
  alerttext+="櫃員號字串過長/n";

 }
 if(document.getElementsByName('jrntl_id')[0].value==""){
  alerttext+="櫃員號字串不可為空/n";

 }
 if(!isStringLong(document.getElementsByName('jrnbr')[0].value,6)){
  alerttext+="行號字串過長/n";

 }
 if(document.getElementsByName('jrnbr')[0].value==""){
  alerttext+="行號字元不可為空/n";

 }
 if(!isStringLong(document.getElementsByName('jrnbr_name')[0].value,30)){
  alerttext+="行名字串過長/n";

 }
  if(document.getElementsByName('jrnbr_name')[0].value==""){
  alerttext+="行名字串不可為空/n";
 
 }
 if(!isStringLong(document.getElementsByName('jrntr_cod')[0].value,4)){
  alerttext+="交易號字串過長/n";
 
 }
 if(document.getElementsByName('jrntr_cod')[0].value==""){
  alerttext+="交易號字元不可為空/n";

 }
 if(!isStringLong(document.getElementsByName('jrntr_cod_name')[0].value,30)){
  alerttext+="交易名字串過長/n";
  
 }
 if(document.getElementsByName('jrntr_cod_name')[0].value==""){
  alerttext+="交易名字串不可為空/n";

 }
 if(!isNum(document.getElementsByName('scvvhamt0')[0].value,19,2)){
  alerttext+="交易金額不是浮點數/n";
 
 }
 if(document.getElementsByName('scvvhamt0')[0].value==""){
  alerttext+="交易金額可以為0,不可為空/n";
 
 }
 if(alerttext!=""){
  alert(alerttext);
 }else{
  document.forms[0].submit();
 }
}
//-->
</script>

<LINK href="${skin.stylepath}/style.css" rel=stylesheet type=text/css>

 

<form action="block.${requestmap.blockkey}.edit.function.handaddinsert" name="handaddfrm" method="post" onsubmit="return dohandaddsubmit(this);">

<table border="0" cellspacing="0" cellpadding="0" STYLE="border-collapse:collapse;margin-bottom:3px" class="${skin.stylename}" id="${requestmap.blockkey}" width="100%">
<tr>
<td class="skin_title" colspan=3>
<table width="100%" border="0" STYLE="border-collapse:collapse" cellspacing="0" cellpadding="0">
<tr>
<td class="skin_left" NOWRAP="true"><IMG SRC="${skin.stylepath}/images/title_left.gif" BORDER="0"></td>
<td class="skin_middle" width="100%" nowrap="true" background="${skin.stylepath}/images/title_bg.gif"><IMG SRC="${skin.stylepath}/images/icon.gif" BORDER="0" align="absmiddle">  --<b>增加</b>
<a href="javascript:openhelp('newseditdetail')"><img src="../skin/images/more1.gif" border=0></a>
</td>
<td class="skin_right" align="right"><IMG SRC="${skin.stylepath}/images/title_right.gif" BORDER="0"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="skin_body_left" background="${skin.stylepath}/images/content_left_bg.gif"></td>
<td class="skin_body" >
<table cellspacing="0" cellpadding="1" width="100%">

 <TR>
 <TD >櫃員號:</TD>
 <TD><INPUT TYPE="text" id="jrntl_id" NAME="jrntl_id" value="" size="40"   onpropertychange = "queryUserInfo();" > 櫃員名:<INPUT TYPE="text" id="counter_name" NAME="counter_name" value="" size="40"></TD>
 
 
 <TD >行號:</TD>
 <TD><INPUT TYPE="text" id="jrnbr" NAME="jrnbr" value="" size="40"></TD>
 </TR>
 <TR>
 <TD >行名:</TD>
 <TD><INPUT TYPE="text" id="jrnbr_name" NAME="jrnbr_name" value="" size="40"></TD>
 
 <TD >交易號:</TD>
 <TD><INPUT TYPE="text" NAME="jrntr_cod" value="" size="40"></TD>
 </TR>
 <TR>
 <TD >交易名:</TD>
 <TD><INPUT TYPE="text" NAME="jrntr_cod_name" value="" size="40"></TD>
 
 <TD >交易金額:</TD>
 <TD><INPUT TYPE="text" NAME="scvvhamt0" value="" size="40"></TD>
 </TR>
 <TR>
 <TD >交易日期:</TD>
 <TD><INPUT TYPE="text" NAME="jrnac_dat" readonly onclick="getjrnac_dat()" value="" size="40"></TD>
 </TR>
 
<INPUT TYPE="hidden" NAME="responseURL" value="block.${requestmap.blockkey}.edit.function.handaddeditlist" size="40">
<INPUT class="button" TYPE="button" onclick=interOnSubmit() value=" 提交 "/>
<INPUT class="button" TYPE="reset" value=" 重設 "/>
<INPUT class="button" onclick="location.href='block.${requestmap.blockkey}.edit.function.handaddeditlist';" TYPE="button" value=" 返回 "/>

$requestmap.getToken()
</form>
</table>
</td>
<td class="skin_body_right" background="${skin.stylepath}/images/content_right_bg.gif"></td>
</tr>
<tr>
<td colspan="3" class="skin_bottom">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="skin_bottom_left"><IMG SRC="${skin.stylepath}/images/bottom_left.gif" BORDER="0"></td>
<td class="skin_bottom" background="${skin.stylepath}/images/bottom_bg.gif" width="100%"></td>
<td class="skin_bottom_right"><IMG SRC="${skin.stylepath}/images/bottom_right.gif" BORDER="0"></td>
</tr>
</table>
</td>
</tr>
</table>
   
   

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.