<mce:script language="JavaScript"><!--<br />var request = false; </p><p>var flag = true; </p><p>//建立XMLHttpRequst對象的一個執行個體<br />function createRequest()<br />{<br /> if(window.XMLHttpRequest)<br /> {<br /> request = new XMLHttpRequest();<br /> }<br /> else if(window.ActiveXObject)<br /> {<br /> request = new ActiveXObject("Msxml2.XMLHTTP");<br /> }<br /> if (!request){<br /> alert("Error initializing XMLHttpRequest!");<br /> }<br />} </p><p>function getIsNotRepeat() {<br /> createRequest();<br /> var exportDate = document.frmExportSubjectBalance.strExportSubjectBalanceDate.value;<br /> /* 修改這裡 */<br /> var url = "<%=strContext%>/FindExistSubjectBalance.jsp?exportDate=" + exportDate;<br /> request.open("GET", url, false);<br /> request.onreadystatechange = updatePage;<br /> request.send(null);<br />} </p><p>function updatePage() {<br /> if (request.readyState == 4) {<br /> if (request.status == 200) {<br /> var respText = request.responseText;<br /> /* 這裡也要修改 */<br /> /* 返回1,帳戶餘額已存在 */<br /> if( respText == 1 ){<br /> if(confirm('帳戶餘額已存在,是否重新匯入?')){<br /> flag = true;<br /> }else{<br />flag = false;<br /> }<br /> }<br /> }<br /> }<br />}<br />// --></mce:script>
控制頁面有如下代碼:
PrintWriter printWriter = response.getWriter();<br /> /* 操作資料庫的結果 */<br /> printWriter.println(isExist);<br /> printWriter.flush();<br /> printWriter.close();