UNPKG

basic-ui-js

Version:

A lightweight JavaScript library for building web-based applications with simple code. No need to write HTML or CSS — just use basic JavaScript.

67 lines (48 loc) 1.83 kB
<!DOCTYPE html> <html lang="en"> <head> <title>First Example</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> <!-- LIBRARY FILES --> <link rel="stylesheet" type="text/css" href="basic/basic.min.css"> <script src="basic/basic.min.js" type="text/javascript" charset="utf-8"></script> <script> // VARIABLES let lblText; let clickedCount = 0; // First running function. window.onload = function() { page.color = "whitesmoke"; // GROUP: AutoLayout (Default: horizontal centered) AutoLayout({ // flow: "horizontal", // "vertical" // align: "center", // "top left", "center right" // gap: 0, // padding: 0, // [0, 0, 0, 0] }); // LABEL: Clickable label lblText = Label({ text: "Click Me", color: "white", padding: [12, 4], round: 4, border: 1, borderColor: "rgba(0, 0, 0, 0.1)", }); that.elem.style.cursor = "pointer"; that.on("click", increaseOne); endAutoLayout(); }; // OTHER FUNCTIONS const increaseOne = function() { clickedCount++; lblText.text = "Clicked Count: " + clickedCount; println(clickedCount); }; </script> </head> <body> <!-- HTML content --> </body> </html>