I am trying to use an onclick or onchange inline event to trigger a change the input type in my html form, I have been researching this for quite some time, but can't figure it out. I could really use some help. I think it will work if I can trigger the event based on the clients radio button selection.
<form name="selectiontype">
<input type="radio" name="selecttype" Value="one" />selection1
<input type="radio" name="selecttype" Value="one" />selection2
<input type="radio" name="selecttype" Value="one" />selection3
<input type="radio" name="selecttype" Value="three" />selection4
<p>Please enter your type selection</p>
<input type="text" name="myElement" id="myElement" />
<script>
var i = 5;
var x = 6;
if (selecttype = three) {{
for (i = 5; i < 12; i++) {
myElement.getElementById('myElement').type = 'password';}}
if (selecttype = one) {{
for (x = 6; x < 13; x++) {
myElement.getElementById('myElement').type = 'password';}}
var i = 11;
var x = 12;
if (selecttype = three) {{
for (i=11; i < 16; i++) {
myElement.getElementById('myElement').type = 'text';}}
if (selecttype = one) {{
for (x=12; x < 17; x++) {
myElement.getElementById('myElement').type = 'text';}}
</script>
<input type="Submit" value="done" />
</form>