Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selectedIndex Issue

Status
Not open for further replies.

bizproducer

Programmer
Jan 20, 2005
19
US
I setup this function in my within my head tags and I am calling it like this on the "ContID" dropdown: onchange="state_enable(0)"

Here is the function:

<script Language="JavaScript">
<!--
function state_enable()
{
if (document.Location.ContID.selectedIndex == 6;)
{
document.Location.StateID.disabled="false";
}
else
{
}
//-->
</script>

Why isn't this working? Thanks for your help!
 
Should be something like this
Code:
<script type="text/javascript">
<!--//
function state_enable(sel_value) {
	var d = document.this_form;

	if (sel_value == 6) {
		d.StateID.disabled = 'false';
	}
	else {

	}
}
//-->
</script>

<form name="this_form">

<select name="ContID" onChange="state_enable(this.value)">
	<option value="6">Test
</select>

<select name="StateID" disabled="true">
	<option value="0">Something
</select>

</form>

M. Brooks
 
Thanks for the suggestions, I have tried all of them however and still am not having any luck.
 
I needed to make a couple adjustments but this works.
Code:
<script type="text/javascript">
<!--//
function state_enable(sel_value) {
    var d = document.this_form;

    if (sel_value == 6) {
        d.StateID.disabled = [b]false[/b];
    }
    else {

    }
}
//-->
</script>

<form name="this_form">

<select name="ContID" onChange="state_enable(this.value)">
    [b]<option value="">Select One[/b]
    <option value="6">Test 1
</select>

<select name="StateID" disabled="true">
    <option value="">Select One
    <option value="0">Test 2
</select>

</form>

M. Brooks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top