Hi,
Why would we not refer you to a wiki article or a thread if they contain the information you need to get your answer ?
I will do so in this case, as you are missing some vital points here and I do have a wiki article that will help you get to your answer.
First, you need to realize that placing contents in an HtmlBox and that Html contents are not "connected" to your Visual WebGui application, you do not have a direct link between your Html and your Visual WebGui application. Your HtmlBox's contents do in that case behave like a completely seperate application, and with your code in your post, you don't have any connection server-side between your HtmlBox's contents and your Visual WebGui application.
You do however have a client-side "oppertunity" to get to your HtmlBox contents via the Browser's DOM model, and that's where the dreaded reference to a Wiki article comes into the picture, as you can see in this article here, how to get to the HtmlBox and from there you should be able to get to your javascript within the HtmlBox and execute your function.
When you have established a client side access to your HtmlBox's contents, you will need to got the information you are after to your Visual WebGui application, and for that you will need to raise an event client side and fire it to your Visual WebGui application and for that you can use the ideas from this sample here.
Please let us know if this information is not enough for you to put the pieces together and then we'll see what can be done.
Palli