説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

output.js 607B

12345678910111213141516171819202122
  1. function receiveMessage(event) {
  2. var html = event.data;
  3. insertCards(html);
  4. }
  5. function insertCards(html) {
  6. // Remove all previous content
  7. while (document.body.hasChildNodes()) {
  8. document.body.removeChild(document.body.lastChild);
  9. }
  10. // Create a div that holds all the received HTML
  11. var div = document.createElement("div");
  12. div.setAttribute("class", "output-container");
  13. div.id = "output-container";
  14. div.innerHTML = html;
  15. // Add the new div to the document
  16. document.body.appendChild(div);
  17. }
  18. window.addEventListener("message", receiveMessage, false);