onChange value

Got a simple list that when the options change it fires an function ajaxcall.

Is it possible to put the value of the change and other lists in?

So for example, current code is:-
<select name="select1" size="5" STYLE="width: 150px" onChange="ajaxcall('catSel2.php',ajaxCat1,'catSel2');">
<select name="select2" size="5" STYLE="width: 150px" onChange="ajaxcall('catSel2.php',ajaxCat1,'catSel2');">

Id like it to say something like:-
<select name="select1" size="5" STYLE="width: 150px" onChange="ajaxcall('catSel2.php?select1=' . select1.value . '&select2=' . select2.value . ',ajaxCat1,'catSel2');">

Any ideas?

Thank you
Who is Participating?
superm401Connect With a Mentor Commented:
Try adding ids along with the names, then:

<select name="select1" id="select1" size="5" STYLE="width: 150px" onChange="ajaxcall('catSel2.php?select1=' + document.getElementById('select1').value + '&select2=' + document.getElementById('select2').value + ',ajaxCat1,'catSel2');">

There are other ways to do this, but this is clear enough.  Also, note that + is used for concatenation.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.