Spaces:
Running
Running
function fx(n){ | |
var a=1,b=1; | |
for(i=2;i<=n;i++){[a,b]=[b,a+b]}; | |
return a | |
} | |
function onbuttonclick(idStr) | |
{ | |
switch(idStr) | |
{ | |
case "fn":{ | |
let curSheet = wps.EtApplication().ActiveSheet; | |
if (curSheet){ | |
curSheet.Cells.Item(1, 1).Formula="执一以为天下式" + curSheet.Cells.Item(1, 1).Formula | |
} | |
break; | |
} | |
case "fb":{ | |
const doc = wps.EtApplication().ActiveSheet; | |
if (doc){ | |
const x=wps.EtApplication().InputBox('请输入需要生成的项序号','测试','5',200,200) | |
doc.Cells.Item(1, 1).Formula=fx(Number(x)) | |
} | |
break; | |
} | |
case "fn2":{ | |
const doc2 = wps.EtApplication().ActiveSheet | |
if (doc2){ | |
doc2.Cells.Item(1, 1).Formula=document.querySelector("#畅心 > img").src | |
} | |
break; | |
} | |
} | |
} | |
window.onload = ()=>{ | |
var xmlReq = WpsInvoke.CreateXHR(); | |
var url = location.origin + "/.debugTemp/NotifyDemoUrl" | |
xmlReq.open("GET", url); | |
xmlReq.onload = function (res) { | |
var node = document.getElementById("DemoSpan"); | |
window.document.getElementById("DemoSpan").innerHTML = res.target.responseText; | |
}; | |
xmlReq.send(); | |
} |