In above code you will have to make some changes like :
instead of myControl1.UserText
use document.frm.getElementById("Here the Id will be some concated string with myControl1$.**")
** You can view the viewsource of html page to see the id of that textbox.
Another thing is that
In stead of frm.txt.value
use document.frm.getElementById("txt").value