Examples of Using Lotto-K Web APIs

최신 로또 번호 가져오기

Source

<div id="lottok">loading...</div>
<script type="text/javascript">
function loadlot(a) {
  lotpane = document.getElementById('lottok');
  lotpane.innerHTML = '제 <span style="color: green;"><b>' +
      a.gno + '</b></span>회 (' + a.gdate + ')<br /><b><span style="color: red;">' + 
      a.nums + '</span> / <span style="color: blue;">' + a.bnum + '</span></b>';
}
</script>
<script type="text/javascript" src="http://lotto.kaisyu.com/api?method=get&callback=loadlot">
</script>

Results

loading...

로또 번호 당첨 확인하기

Source

<input type="button" value="로또 번호 당첨 확인" name="Check" onclick="javascript:onClickCheck();">
<br /><br />
<div id="lotchk"></div>
<script type="text/javascript">
function onClickCheck() {
  v = prompt("numbers: ", "1,2,3,4,5,6");
  var scrpt = document.createElement('script');
  scrpt.type = 'text/javascript'; 
  scrpt.src = 'http://lotto.kaisyu.com/api' +
     '?method=check&callback=lot_check_result&numlist=[[' +
     encodeURI(v) + ']]';
  document.getElementsByTagName('head')[0].appendChild(scrpt);
}
function lot_check_result(a) {
  lotpane = document.getElementById('lotchk');
  gr = a[0][0] == 0 ? "꽝" : a[0][0];
  mtch = a[0][1];
  lotpane.innerHTML = '등수: <span style="color: red;"><b>' + gr +
      '</b></span><br/>일치 번호: <span style="color: blue;"><b>' + mtch + '</b></span>';
}
</script>

Results