|
| 1 | +package org.expr.mcdm |
| 2 | + |
1 | 3 | import org.scalajs.dom |
2 | 4 | import org.scalajs.dom.HTMLInputElement |
3 | 5 | import org.scalajs.dom.HTMLDivElement |
| 6 | +import org.scalajs.dom.HTMLButtonElement |
| 7 | +import org.scalajs.dom.HTMLTextAreaElement |
| 8 | +import org.w3c.dom.html.HTMLUListElement |
4 | 9 |
|
5 | 10 |
|
6 | 11 | val document = dom.document |
7 | 12 | val window = dom.window |
8 | | -val status: HTMLDivElement = document.getElementById("status").asInstanceOf[HTMLDivElement] |
9 | | - |
10 | | -def status(msg: String): Unit = |
11 | | - status.textContent = msg |
12 | 13 |
|
| 14 | +def registerEvents(): Unit = |
| 15 | + val input: HTMLInputElement = document.getElementById("btn_generate_decmat").asInstanceOf[HTMLInputElement] |
| 16 | + window.console.log("We are in registerEvents") |
| 17 | + input.onclick = (e: dom.Event) => |
| 18 | + window.console.log("Button clicked") |
| 19 | + val decmatoutput: HTMLDivElement = document.getElementById("div_decmat_output").asInstanceOf[HTMLDivElement] |
| 20 | + val textarea : HTMLTextAreaElement = document.getElementById("textarea_decmat").asInstanceOf[HTMLTextAreaElement] |
| 21 | + val textcontent = textarea.value |
| 22 | + decmatoutput.innerHTML = "" |
| 23 | + decmatoutput.appendChild(HtmlUtils.makeTable(HtmlUtils.parseTextToTable(textcontent))) |
13 | 24 | @main def hello(): Unit = |
14 | | - val txtname = document.getElementById("txtname").asInstanceOf[HTMLInputElement] |
15 | | - txtname.oninput = (e: dom.Event) => { |
16 | | - status("Hello, " + txtname.value) |
17 | | - } |
18 | | - status("Ready") |
| 25 | + window.console.log("Hello, world!") |
| 26 | + registerEvents() |
| 27 | + window.console.log("Registered events") |
19 | 28 |
|
20 | 29 |
|
0 commit comments