I used the onchange event in select:
Expand|Select|Wrap|Line Numbers
- <select name="menu"
- onchange="window.location.href='?code='+this.options[this.selectedIndex].value;">
- <option value="code1">Testo 1</option>
After loading I can read the value parameter code and show / hide items in relation to that value.
Now I upgraded to AJAX and I find this situation:
Expand|Select|Wrap|Line Numbers
- <select name="code" id="code" onChange="cerca_province();">
- <option value="code1">Testo 1</option>
Expand|Select|Wrap|Line Numbers
- function cerca_province()
- {
- code=document.form.code.options[document.form.code.selectedIndex].value
- if (window.XMLHttpRequest) {
- estrai_province= new XMLHttpRequest();
- estrai_province.onreadystatechange = ricevi_province;
- estrai_province.open("GET", "estrai.asp?code="+code, true);
- estrai_province.send(null);
- } else if (window.ActiveXObject) {
- estrai_province= new ActiveXObject("Microsoft.XMLHTTP");
- if (estrai_province) {
- estrai_province.onreadystatechange = ricevi_province;
- estrai_province.open("GET", "estrai.asp?code="+code, true);
- estrai_province.send();
- }
- }
- }
- function ricevi_province() {
- var province;
- if (estrai_province.readyState == 4) {
- province=estrai_province.responseText;
- document.getElementById('provincia').innerHTML = province;
- }
- }
But this way I can not read the value of parameter code and show / hide items in relation to that value.
Can you help me? Can someone help me?
Thanks in advance.