투자정보
Investment Information
" src="https://code.jquery.com/jquery-3.1.1.min.js">
" src="../js/placeholders.min.js">
" src="../js/gnb.js">
" src='http://asp1.krx.co.kr/inc/js/asp_chart.js'>
" language="javascript">
/* 크롬사용 추가 스크립트 */
if( document.implementation.hasFeature("XPath", "3.0") ){
if( typeof XMLDocument == "undefined" ){ XMLDocument = Document; }
XMLDocument.prototype.selectNodes = function(cXPathString, xNode){
if( !xNode ) { xNode = this; }
var oNSResolver = this.createNSResolver(this.documentElement)
var aItems = this.evaluate(cXPathString, xNode, oNSResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
var aResult = [];
for( var i = 0; i < aItems.snapshotLength; i++){aResult[i] = aItems.snapshotItem(i); }
return aResult;
}
XMLDocument.prototype.selectSingleNode = function(cXPathString, xNode){
if( !xNode ) { xNode = this; }
var xItems = this.selectNodes(cXPathString, xNode);
if( xItems.length > 0 ){return xItems[0]; }
else{return null; }
}
Element.prototype.selectNodes = function(cXPathString){
if(this.ownerDocument.selectNodes){ return this.ownerDocument.selectNodes(cXPathString, this);}
else{throw "For XML Elements Only";}
}
Element.prototype.selectSingleNode = function(cXPathString){
if(this.ownerDocument.selectSingleNode){return this.ownerDocument.selectSingleNode(cXPathString, this); }
else{throw "For XML Elements Only";}
}
}
function getXMLHttpRequest() {
if(window.ActiveXObject) {
try {
return new ActiveXObject('Msxml2.XMLHTTP');
} catch(e) {
try {
return new ActiveXObject('Microsoft.XMLHTTP');
} catch(e1) {
return null;
};
};
} else if (window.XMLHttpRequest){
return new XMLHttpRequest();
} else {
return null;
};
};
/* 크롬사용 추가 스크립트 */
// oonreadystatechange funcion 설정해제
function SetNULLFunction()
{
if (httpObj != null){
httpObj.OnReadyStateChange = document.getElementById("NULL");
}
}
// onreadystatechange functon 설정
function SetFunction() {
if (httpObj != null){
httpObj.OnReadyStateChange = MyOnReadyStatChange;
}
}
//xml data 요청
function SendRequest() {
if (httpObj != null){
try{
httpObj.OnReadyStateChange = MyOnReadyStatChange; //여기에 지정해도 무방함
onChart(1100,300, '004150');
httpObj.DoRequest();
}catch(err){
/* 크롬에서 호출시 */
httpObj = getXMLHttpRequest();
httpObj.onreadystatechange = MyOnReadyStatChange_chrom;
httpObj.open("GET", "https://www.hansolnexg.com/krx_stockinfo/hansol_stockinfo.php?type=stock&lang=K&code=004150", true);
httpObj.send(null);
}
}
}
function MyOnReadyStatChange_chrom() {
if(httpObj.readyState == 4) {
if(httpObj.status == 200) {
var strXml = httpObj.responseText;
strXml = strXml.replace(/\n/g, "");//행바꿈제거
var xmlParser = new DOMParser();
var xmlDoc = xmlParser.parseFromString(strXml, 'text/xml');
var cDate = document.getElementById("createDate")
dipDate = xmlDoc.selectSingleNode("stockprice").getAttribute("querytime");
parseNode(xmlDoc);
setTimeout(SendRequest, 10000);
} else {
alert('error : ' + httpObj.status);
};
};
};
// onreadystatechange funcion 이 이function 으로 설정된 경우 작동
var dipDate;//날짜시간처리
function MyOnReadyStatChange() {
var nReadyState = httpObj.ReadyState;
if (4 == nReadyState){
if (httpObj.Status != 200){
alert("Error Code: " + httpObj.Status + "\r\n" + httpObj.StatusText);
}
else{
var contentType = httpObj.getResponseHeader("Content-Type");
if (contentType.length < 8 || contentType.substring(0, 8) != "text/xml") {
alert("잘못된 데이터입니다. 오랫동안 사용하지 않아 세션이 종료되었거나, 서버오류입니다!");
return;
}
var xmlDoc = httpObj.ResponseXML;
var cDate = document.getElementById("createDate")
dipDate = xmlDoc.selectSingleNode("stockprice").getAttribute("querytime");
parseNode(xmlDoc);
setTimeout(SendRequest, 10000);
}
}
}
function parseNode(xmlDoc){
/*
주가정보 : TBL_StockInfo
호가 : TBL_Hoga
시간대별체결가 : TBL_TimeConclude
회원사별거래 : TBL_AskPrice
일자별시세 : TBL_DailyStock
var node = xmlDoc.selectSingleNode("stockprice/TBL_StockInfo");
if (node != null) parseStastistics(node);
node = xmlDoc.selectSingleNode("stockprice/TBL_Hoga");
if (node !=null) parseNogoPrice(node);
node = xmlDoc.selectSingleNode("stockprice/TBL_TimeConclude");
if (node != null) parseStatusPDay(node);
node = xmlDoc.selectSingleNode("stockprice/TBL_DailyStock");
if (node != null) parseCallPrice(node);
node = xmlDoc.selectSingleNode("stockprice/TBL_AskPrice");
if (node != null) parseDealPMemberCorp(node);*/
}
function parseDealPMemberCorp(dealNode){
/*
var statusPDayTbl = document.getElementById("TBL_AskPrice");
if (statusPDayTbl != null){
var childNodes = dealNode.selectNodes("AskPrice");
//