Welcome to the group.
There are currently two ways to construct HTML in WebSharper. One is
to generate it on the server, usually in the context of a sitelet.
This HTML appears in your browser as you click View Source. The other
way is to construct DOM nodes that are appended dynamically in
JavaScript.
In fact, your code always executes in one of the two contexts: either
on the server, or on the client.
IntelliFactory.Html.* contains combinators for server-side HTML generation.
IntelliFactory.WebSharper.Html.* contains combinators for client-side
HTML generation, constructing DOM nodes.
This sample, among others, demonstrates the use of the client-side combinators:
http://websharper.com/samples/HelloWorld
To bridge the two worlds, server and client, one defines controls.
Following the example:
type HelloWorldViewer() =
inherit Web.Control()
[<JavaScript>]
override this.Body = HelloWorld.Main () :> _
Now this control can be embedded into the server-side HTML, as in `Div
[new HelloWorldViewer()]`. What happens then is the server emits a
placeholder, say `<div id="ws1"/>`, and the client on JavaScript
startup runs `HelloWorld.Main` in JavaScript, produces some DOM nodes
and replaces the placeholder.
Hope it helps, and you are welcome to ask further questions.
Thanks,
Anton
--
Kind Regards,
Anton Tayanovskyy
WebSharper™ - type-safe JavaScript in F#
http://intellifactory.com