|
猜的没错,用的是ABAP的类用来控制输出HTML和JavaScript
'<html><head>'
'<meta http-equiv="content-type" content="text/html">'
'<style type="text/css">'
'* { font: bold 12px sans-serif}'
'span { position: absolute; width: 16px; height: 16px;'
' font-size: 6pt; background: url("blank.gif")}'
'div { background: silver; margin: 8px 0;'
' text-align: center; border: 2px inset white}'
'td { text-align: center; padding: 0}'
'td div{height: 24px; width: 30px; margin: 0;'
' padding: 3px; border: 1px gray solid}'
'#wMain{position: absolute; padding: 0 8px;'
' border: 2px outset white}'
'#wTool{height: 34px}'
'</style>'
'<script>'
'var DX=10, DY=10, BB=98,'
' game=1, tID, tm=0, mouse_left=0, mouse_right=2,'
' images=[], SZ=16, x, y, b="",'
' imagesInfo = ['
' "blank *0ABCDEFGH",'
' "bombdeath X", "bombrevealed &",'
' "bombmisflagged @", "bombflagged mMabcdefgh",'
' "open1 1", "open2 2", "open3 3",'
' "open4 4", "open5 5", "open6 6",'
' "open7 7", "open8 8", "open0 ."'
'];'
'/*VARIABLES_INITIALIZATION_HERE_DONT_DELETE*/'
'function init(){'
' c1.innerText = BB;'
' c2.onclick = abapHandler("IMG" , mouse_left, "newgame");'
' document.onclick = abapHandler("SPAN", mouse_left, "click");'
' document.onmouseup= abapHandler("SPAN", mouse_right,"mouseup");'
' var p, w = DX*SZ+4; var h = DY*SZ+4;'
' setSize(wBrd, w, h);'
' setSize(wMain, w+20);'
' map(imagesInfo, function(x){'
' map((p = x.split(" "))[1].split(""),'
' function(ch){images[ch]=p[0]+".gif"})}'
' )'
'}'
'function updateCells(game_state, bomb_left){'
' game = game_state; c1.innerText = bomb_left;'
' var x, i, seq = b.split("|"); b = "";'
' for(i=0;i<seq.length;i++)'
' if (x=seq) with(document.getElementById("x"+x.slice(0,-1)))'
' style.backgroundImage = "url("+images[x.slice(-1)]+")";'
' if (game==2) {clearTimeout(tID); c2.src = "facedead.gif"}'
' if (game==3) {clearTimeout(tID); c2.src = "facewin.gif" }'
'}'
'function abapHandler(tag, mouse_button, action){'
' return('
' function(){'
' var ev = window.event, obj = ev.srcElement;'
' if (obj.nodeName == tag && ev.button==mouse_button) {'
' tID = tID ? tID : setTimeout("onTimer()", 1000);'
' callback.href ='
' "SAPEVENT:"+action+"?ID="+obj.id.slice(1)+"&TIME="+tm;'
' callback.click();'
' }'
' }'
' )'
'}'
'function onTimer(){'
' c3.innerText = ++tm;'
' tID = (game==1) ? setTimeout("onTimer()", 1000) : tID;'
'}'
'function setSize(obj, w, h){'
' obj.style.width = w;'
' if (h) obj.style.height = h;'
'}'
'function map(list, func){'
' var a = new Array(list.length);'
' for (var i=0;i<list.length;i++) a=func(list,i);'
' return a;'
'}'
'</script></head>'
'<body onload="init()">'
'<div id=wMain>'
'<div id=wTool><table border=0 id=wHdr>'
'<tr>'
' <td width=34px><div id=c1>0</div></td>'
' <td width=100%><img id=c2 src="facesmile.gif"></td>'
' <td width=34px><div id=c3>0</div></td>'
'</tr></table></div>'
'<div id=wBrd>'
'<script>'
' for(y=0;y<DY;y++) for(x=0;x<DX;x++) document.write('
' "<span id=x"+((y+1)*(DX+2)+x+1)+" style=\"left:"'
' +(10+SZ*x)+"px;top:"+(52+SZ*y)+"px;\"></span>")'
'</script>'
'</div>'
'<div><a id=btnSwitch href="SAPEVENT:switch?0">'
'switch to ABAP</a>'
'</div></div>'
'<a id=callback style="display:none"'
' href="SAPEVENT:click?dummy">SAPEVENT:click</a>'
'</body>'
'</html>' |
|