I'm not entirely clear on what you are trying to do, myself. It seems clear that you want to completely replace the combobox with the selection in the combobox, but that seems a bit weird, which is why I ask. if it is, you'll want the onchange event, not onclick. And you'll want to change the HTML itself. You can either do this with the DOM replaceChild() method, or you can create an element to encompass the select tag, and replace the innerHTML of that item:
<html>
<body>
<input type="text" id="xyz" />
<span id="stateselection">
<select size="0" id="regstater" onchange= "stateselection.innerHTML=regstater.value">
<option value="AL">Alabama</option>
<option value="WY">Wyoming</option>
</select>
</span>
</body>
</html>
By the way- this isn't in a form, but the name attribute is only used for form submissions. the id tag is used when dealing with the DOM; Your original script was failing because there was no regstater2 id, for example; but as you have them defined, even if the name was lookup-able, they would be the same item anyway. Not sure what you expected when setting a property to itself
Another reason I'm unsure if this is actually the sort of thing you were after is because if it is the textbox sorta just- sits there and does nothing. If you want to set the value of the textbox to the state when the state combobox is changed, that's fairly similar:
<html>
<body>
<input type="text" id="xyz" />
<select size="0" id="regstater" onchange= "xyz.value=regstater.value">
<option value="AL">Alabama</option>
<option value="WY">Wyoming</option>
</select>
</body>
</html>
Seriously, what is the problem with its OnClick event handling? I thought it was pretty robust. No?
Nothing really. But it's typically a pain in the *censored* trying to get any non-trivial logic into a string attribute. Typically you would write the code in a separate file as a function, include it in the file by using a <script> tag, and then the event is something like onchange=handlechange().