GENINE LABS 交易所
With Firefox giving the HTML5 dialog element support since early 2022, we can now make use of this HTML 5.2 element to simplify our websites and make our life easier. It's usage is very simple, we can add the dialog tags to our page and put some content inside them. <dialog> <p>Testing dialogs</p> <button>Ok</button> </dialog> Opening and closing the dialog The dialog won't display itself by default unless you set the open attribute: <dialog open> <p>Testing dialogs</p> <button>Ok</button> </dialog> Alternatively, the HTMLDialogElement comes with 3 methods you can call using JavaScript: var dialog = document.getElementsByTagName("dialog")[0]; // Show() will display it same way as the "open" attribute does, allowing you to still interact // with the rest of HTML elements in the page not behind the dialog. dialog.show(); // This one…