SetBody (Method)

From Legacy Roblox Wiki
Revision as of 19:18, 29 October 2023 by Pongo02 (talk | contribs) (Created page with "<onlyinclude>{{Method|name = SetBody |arguments = String ''HTML'' |description = Sets the HTML contents of the window. Can be run on a single window continuously, allowing for dynamic content. |object = HtmlWindow }}</onlyinclude> {{clear floats}} {{Example|Sets and then updates the body to count from 0 to 10: <syntaxhighlight lang="lua"> local HtmlService = game:service("HtmlService") local htmlWindow = HtmlService:NewWindow() local initialDisplayed = false htmlW...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
SetBody( String HTML )
Returns nil
Description: Sets the HTML contents of the window. Can be run on a single window continuously, allowing for dynamic content.
Member of: HtmlWindow


Example
Sets and then updates the body to count from 0 to 10:
local HtmlService = game:service("HtmlService")
local htmlWindow = HtmlService:NewWindow()

local initialDisplayed = false
htmlWindow.DocumentComplete:connect(function()
	if not initialDisplayed then
		htmlWindow:SetBody(0)
		initialDisplayed = true
	end
end)

htmlWindow:Show()
htmlWindow:Navigate()

for i = 0, 10 do
	htmlWindow:SetBody(i)
	wait(1)
end