mirror of
https://github.com/boxgaming/qbjs.git
synced 2024-05-12 08:00:12 +00:00
Page:
Dom.Create
Pages
Adding Support for a New Keyword
Console.Echo
Console.Log
Console.LogLevel
Dom.Add
Dom.Alert
Dom.Confirm
Dom.Container
Dom.Create
Dom.Event
Dom.Get
Dom.GetImage
Dom.Prompt
Dom.Remove
Export
FS.DownloadFile
FS.ListDirectory
FS.UploadFile
G2D.Bezier
G2D.Curve
G2D.Ellipse
G2D.FillCircle
G2D.FillEllipse
G2D.FillRoundRect
G2D.FillTriangle
G2D.InvertRect
G2D.LineCap
G2D.LineDash
G2D.LineDashOff
G2D.LineWidth
G2D.RotoZoom
G2D.RoundRect
G2D.SaveImage
G2D.Shadow
G2D.ShadowOff
G2D.Triangle
Home
Import
QBasic Language Support
Roadmap
Samples
Storage.Clear
Storage.Get
Storage.Key
Storage.Length
Storage.Remove
Storage.Set
Supported Keywords
Unsupported Keywords
2
Dom.Create
boxgaming edited this page 2023-09-25 13:46:55 -05:00
Table of Contents
Creates a new html element and adds it to the current page.
The function version of this keyword will return an object reference to the DOM element which can be further manipulated or passed in as input to subsequent DOM operations.
Syntax
domElement = Dom.Create (elementName$ [, parent] [, text$] [,elementId$] [, insertBefore])
Dom.Create elementName$ [, parent] [, text$] [,elementId$] [, insertBefore]
Parameters
- The elementName$ parameter indicates the type of html element to be created (i.e. "div", "input", "button").
- The option parent parameter can be either the object returned from a previous Dom.Create method or Dom.Get method or the String id of the parent element. The created element will be appended to the end of the current contents of the parent element (unless the insertBefore parameter is specified).
- The optional text$ parameter will set the inner text content of the created element. For form input elements this will set the element's value attribute.
- The optional elementId$ parameter will set the id attribute of the created element. This id can be referenced by subsequent DOM methods.
- The optional insertBefore parameter can be either the object returned from a previous Dom.Create or Dom.Get method or the String id of a sibling html element. The newly created element will be inserted into the specified parent container element immediately before the indicated insertBefore element.
Examples
Example1: Create a new html BUTTON element inside a DIV panel which will be placed beneath the screen canvas.
Import Dom From "lib/web/dom.bas"
Dim panel, btn
panel = Dom.Create("div")
btn = Dom.Create("button", panel, "Push Me")
See Also
Dom.Add Dom.Container Dom.Event Dom.Get Dom.GetImage Dom.Remove