Try this...
Call this function onchange of the first select field.
/***************************************************************************
***********************************
*This function is to populate a combo dynamically
****************************************************************************
***********************************/
field = document.frmLogin.cmb_destination.options
function populateCombo(field)
{
var ComboLength=field.length;
var DestinationArray = new Array();
DestinationArray[0] = "India"
DestinationArray[1] = "Europe"
DestinationArray[2] = "USA"
if(ComboLength > 0)
{
for(var arrindex1=0;arrindex1 < ComboLength;arrindex1++)
{
field[arrindex1] = null;
}
}
for (var arrindex1 = 0; arrindex1 < DestinationArray.length;
arrindex1++)
{
if(arrindex1 == 0)
newOptionName = new
Option(DestinationArray[arrindex1], DestinationArray[arrindex1],true,true);
else
newOptionName = new
Option(DestinationArray[arrindex1], DestinationArray[arrindex1]);
field[optionIndex3++] = newOptionName;
}
field.length = optionIndex3;
}
Regards,
Sabari Arasu,
AIG - TCS CTC,
Ambattur,
Chennai.
India
> -----Original Message-----
> From: Kesav, Ramesh [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, May 17, 2002 11:09 AM
> To: [EMAIL PROTECTED]
> Subject: off topic - java script
>
> Hi all,
>
> i have 2 select boxes.
> If i choose a value from the first select box the second select box should
> have appropriate values.
>
> eg: first one has science/ IT etc.,
>
> if i choose science the second should show
> say
> maths/ history/ physics/ chemistry
>
> if i choose IT from the first , the second box should show
> say
> hardware/ software /networking / etc.,
>
> if anybody has a piece of code for this i would really appreciate it.
>
>
>
>
> Regards
>
> Ramesh Kesavanarayanan
> [EMAIL PROTECTED]
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html