And why wouldn't you share your solution with others to help them? You can actually pass strings as well, it's just a bit more tricky... Here is a working solution:
ui html panel("<input type=\"button\" value=\"button\" onclick=\"ubot.runScript(\'loadMain("Test string from html!")\')\">", "")
define loadMain(#test) {
alert(#test)
}
Notice that instead of escaping Ubot double quotes around input parameters with \ (as in Sifuhall's example), you actually need to HTML encode the double quotes (").