Jump to content

newbie - onclick or onchange assistance


mooby1231
 Share

Recommended Posts

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>
Link to comment
Share on other sites

 

I am trying to use an onclick or onchange inline event to trigger a change the input type in my html form...

 

Where is this "onclick or onchange inline event" that you say you are using?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...