document.write() not working - alternatives?

Hi guys,

I am designing some html markup and it should be different depending on a variable in my html page javascript.
However, I seem to be unable to insert html code from the page javascript. I tried the code below and it works if I save it as a html page but not if I put it in a variable and assign it as a dataprovider to a html area in Servoy.

Any tips on making it work will be appreciated.
Thanks in advance.

      <html>
			<head>
			  <script>
					function addElement () {
					  document.write("Dynamic Text");
					}
				</script>
			</head>
			<body>
                                <div>text before dynamic insert</div>
								<div>
				<script>addElement();</script>
				</div>
                     <div>           text after dynamic insert</div>
			</body>
		</html>

Sample webclient solution (not displaying the ‘Dynamic Text’ label) attached.

Cheers,
Maria

testDynHtml.servoy (3.35 KB)