日期:2014-05-16 浏览次数:20765 次
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Login</title> </head> <script> function createNewRequest(){ var HttpRequest = null ; try { //if (window.XMLHttpRequest) { // Mozilla, Safari, ... HttpRequest = new XMLHttpRequest(); //} else if (window.ActiveXObject) { // IE //HttpRequest = new ActiveXObject("Microsoft.XMLHTTP"); //} if (HttpRequest.overrideMimeType) { // set type accordingly to anticipated content type if(type.toUpperCase() == "XML") HttpRequest.overrideMimeType('text/xml'); else HttpRequest.overrideMimeType('text/html'); } } catch (e) { //showWarnningMessage(errorText, e.message); } return HttpRequest ; } function ajaxCall(urlString,data){ var pageRequest = createNewRequest(); pageRequest.open('GET', urlString); //pageRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); pageRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8"); var encodedData = encodeURI(data); //pageRequest.send(""); pageRequest.send(encodedData); pageRequest.onreadystatechange=function(){ //alert("readyState = " + pageRequest.readyState + "; HTTP Status = " + pageRequest.status); //var returnText = pageRequest.responseText ; if (pageRequest.readyState == 4 && pageRequest.status == 200){ document.getElementById("f1").src="http://172.16.5.158:9080/portal/jsp/viewScoreboard.do?id=2015.209"; } } } function doSubmit(){ ajaxCall("http://172.16.5.158:9080/portal/j_security_check?j_username=admin&j_password=admin","abcd"); } </script> <body> <input type="button" value="Report" onclick="doSubmit()"> <iframe style="display:inline" src="" id="f1" name="f1" width=100% height=100%></iframe> </body> </html>