Javascript fails in WebHTMLViewer

I haven’t been able to run javascript, whether included in a Web 2.0 WebHTMLViewer’s HTML or via an ExecuteJavascript script directed to the control’s document. Anybody else have this problem?

It would be helpful to know what command you are trying to run.

As javascript in viewer’s document:

function theDate(){
	var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
	var el = document.getElementById("dttxt")
	var d = new Date();
	el.innerHTML = months[d.getMonth()] + " " + d.getDate();

Called as body onload=“theDate()”

I suggest looking at the browser’s debug console. I suspect you’re running into some sort of security error.

I’ll take a look. Thanks.

Javascripts run in the WebHTMLviewer, if the document is loaded from a file via URL, but not when the document is loaded as an HTML string. Just to be clear though, I’ve been calling LoadHTML from the view’s Opening or Shown events. Maybe that’s too early. However, I don’t know where else you could do it.

LoadHTML just puts html code on the page. It does not “load” it.