1
我正在測試與科爾多瓦寫一個簡單的文本到卡。在引導按鈕我有科爾多瓦nfc插件寫入文字到nfc卡
onclick="write_btn();"
而且在index.js我已經添加
function write_btn(){
alert("Write some to card");
var message = [
ndef.textRecord("hello, world of NFC"),
];
var sMsg;
nfc.write(message,
function(){sMsg="good";alert("Write Succes");},
function(){sMsg="fals";alert("Nothing got written");}
);
console.log("Writing is: "+sMsg);
alert("Writing is: "+sMsg);
}
但什麼也沒寫,只是警告。如果我在函數write_btn中只有alert(「...」),它會被觸發。 ndef是一個全局變量,對嗎?
問候
你弄明白了嗎? –