In most JavaScript-capable web browsers, it is possible to execute JavaScript statements from an anchor tag using the javascript: protocol as the value of the HREF attribute. For example:
<A href="javascript:square(5);.html">find the square of 5</A>
In ActionScript, we can also execute JavaScript statements from an <A> tag, like this:
theField_txt.htmlText = "<A HREF='javascript:alert(5);'>display the number 5</A>";
However, to include string values in JavaScript statements, we must use the HTML entity " for quotation marks, as in:
theField_txt.htmlText = "<A HREF= 'javascript:alert("hello world");'>" + "display hello world</A>";