如何在不同div上顯示報價和新報價條件。請幫我想說明2的條件,我這樣的代碼:在JSON對象上顯示2條件
function setup() {
output = document.getElementById("output2");
var ws = new WebSocket('wss://www.binary.com/websockets/v3?l=RU');
ws.onopen = function(evt) {
ws.send(JSON.stringify({ticks:'R_50'}));
}
ws.onmessage = function(msg) {
var quote = JSON.parse(msg.data).tick.quote;
var newquote = quote.substr(-1);
log(newquote);//here should be semi-colon
}
}
function log(info) {
//Display information on screen
var p = document.createElement("p");
p.innerHTML = info;
output.appendChild(p);
console.log(info);
}
function sendMessage(msg) {
ws.send(msg);
log("TICKS");
ws.close();
}
window.addEventListener("load", setup, false);
歡迎來到Stack Overflow。請詳細說明背景和你想要達到的目標,因爲目前還不清楚。 – Roope