Bind (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
Created page with "<onlyinclude>{{Method|name = Bind |arguments = Instance '''object''', String '''property''', String '''htmlElementId''' |description = Binds the property of an instance to an HTML input. |object = HtmlWindow }}</onlyinclude> {{clear floats}} {{Example|This code will create a Hint, and Bind an input to the Text property. It will give the option to toggle the Bind: <syntaxhighlight lang="lua"> html = game:service("HtmlService") wind = html:NewWindow() wind:N..." |
No edit summary |
||
Line 39: | Line 39: | ||
wind:Show() | wind:Show() | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
[[Category:Methods]] |
Latest revision as of 22:41, 13 February 2024
![]() | |
Returns | nil |
Description: | Binds the property of an instance to an HTML input. |
Member of: | HtmlWindow |
Example
This code will create a Hint, and Bind an input to the Text property. It will give the option to toggle the Bind:
html = game:service("HtmlService")
wind = html:NewWindow()
wind:Navigate()
hint = Instance.new("Hint", game.Workspace)
hint.Name = "BindedHint"
function Call(ValueReturn)
if ValueReturn == "bind" then
wind:Bind(hint, "Text", "scriptsrc")
elseif ValueReturn == "unbind" then
wind:Unbind()
end
end
wind.DocumentComplete:connect(function(url)
wind:SetBody([==[
<input id="scriptsrc">
<input type="submit" onclick="window.external.Call('bind');" value="Bind Me!">
<input type="submit" onclick="window.external.Call('unbind');" value="Unbind Me!">
<img style="display: none;" src='' onerror="window.external.Call('bind');">
]==])
end)
wind:SetCallback(Call)
wind:Show()