Newsgroup: it.comp.lang.javascript
Titolo: Perchè non funziona con navigator?

Salve,
non vorrei eccedere in un esigenza, ma ho un problema che non capisco. La
seguente pagina html dovrebbe contenere un form per interrogare un db con
query sql. Tutto funziona con explorer ma in navigator i valori (value) dei
menu a tendina risultano sempre "null". Esempio:
il codice javascript :
if(document.queryform.order.value=='date')order='
event_year,event_month,event_day ';
else if(document.queryform.order.value=='name')order=' user_name ';
else if(document.queryform.order.value=='job')order=' user_password';
si riferisce a:
        <select name="order" size="1"  onChange="check()">
          <option value="date" selected>Date</option>
          <option value="name">Username</option>
          <option value="job">Job</option>
        </select>
...ma la variabile    "order" non viene intaccata.
Funzionano tutti gli altri tipi di input tranne select: come mai?
<html>
<head>
<title>Welcome to Adobe GoLive 4</title>
<script language="javascript">
<!--
function allusers(){
document.queryform.qry.value='select
user_name,user_login,user_password,user_email from tusers';
}
function check(){
document.queryform.qry.value='';
var arg='',order='',cond_date='',where=' where event_user_id=user_id
',and='';
for(i=0;i<=8;i++){
if (document.queryform.col[i].checked){
                    arg=arg+document.queryform.col[i].value;
                    for(j=i;j<8;j++){if
((j!=8)&&(document.queryform.col[j+1].checked)){ 
                                                                          arg=arg+',';                                                                         
                                                                           i=j;
                                                                           break;}                                                                                                                                                                                                        
                                     els
e i=j;
                                     }
                                       }
}
if(document.queryform.anno.value=='all')cond_date='';
else {cond_date=' event_year='+document.queryform.anno.value+' ';and='AND'}
if(document.queryform.mese.value!='all'){cond_date=cond_date+and+'
event_month='+document.queryform.mese.value+' ';
                                         and='AND'}
if(document.queryform.giorno.value!='all'){cond_date=cond_date+and+'
event_day='+document.queryform.giorno.value+' ';
                                           and='AND'}
cond_utenti=' ';
if(document.queryform.utenti[1].checked){       
       cond_utenti=and+' user_name=\''+document.queryform.name.value+'\' AND event_user_id=user_id';
       where=' where ';
      }
else cond_utenti=' ';
if(document.queryform.order.value=='date')order=' event_year,event_month,event_day ';
else if(document.queryform.order.value=='name')order=' user_name ';
else if(document.queryform.order.value=='job')order=' user_password'; 
if(arg=='')arg=' * ';
document.queryform.qry.value='select '+arg+' from tUsers,tEvents '+ where +and+cond_date + cond_utenti +' order by '+ order ;
}
function MM_callJS(jsStr) { file://v2.0
  return eval(jsStr)
}
file://-->
</script>
<style type="text/css">
<!--
a:hover {  background-color: #CCCCFF}
td {  color: #3333FF; font-style: italic; font-weight: lighter}
textarea {  }
input {  color: #0000FF; font-size: small; border-style: none; background-color: #CCFFFF}
b {  color: #0000FF; text-decoration: underline; font-variant: small-caps; font-weight: bold}
-->
</style>
</head>
 <body bgcolor="#FFFFFF">
<form method="post" action="
http://www.sawf.org/bin/kaorg.exe/admin?orgid=3
" name="queryform">
  <p><b>What columns do you whant in the table?</b></p>
  <table width="400" border="0">
    <tr>
      <td>user_name 
        <input type="checkbox" name="col" val
ue="user_name" onClick="check()">
      </td>
      <td>user_login
        <input type="checkbox" name="col" value="user_login"
onClick="check()">
      </td>
      <td>user_password
        <input type="checkbox" name="col" value="user_password"
onClick="check()">
      </td>
    </tr>
    <tr>
      <td height="26">user_Email
        <input type="checkbox" name="col" value="user_email"
onClick="check()">
      </td>
      <td height="26">event_title
        <input type="checkbox" name="col" value="event_title"
onClick="check()">
      </td>
      <td height="26">event_details
        <input type="checkbox" name="col" value="event_details"
onClick="check()">
      </td>
    </tr>
    <tr>
      <td>event_month
        <input type="checkbox" name="col" value="event_month"
onClick="check()">
      </td>
      <td>event_day
        <input type="checkbox" name="col" value="event_day"
onClick="check()">
      </td>
      <td>event_year
        <input type="checkbox" name="col" value="event_year"
onClick="check()">
      </td>
    </tr>
  </table>
  <table width="100%" border="0">
    <tr>
      <td>All users
        <input type="radio" name="utenti" checked value="all"
onClick="check()">
      </td>
      <td> one user
        <input type="radio" name="utenti" value="one"
onClick="document.queryform.name.focus();check()">
        <input type="text" name="name" onChange="check()"
onFocus="MM_callJS('document.queryform.utenti[1].checked=1')"
onBlur="MM_callJS('check();')">
        <font size="-5">*write here the exact user_name</font></td>
    </tr>
  </table>
  <table width="100%" border="0">
    <tr>
      <td>Year
        <select name="anno" onchange="check()" size="1">
          <option value="2000">2000</option>
          <option value="2001">2001</option>
          <option value="2002">2002</option>
          <option value="2003">2003</option>
          <option value="2004">2004</option>
          <option value="2005">2005</option>
          <option value="2006">2006</option>
          <option value="2007">2007</option>
          <option value="2008">2008</option>
          <option value="2009">2009</option>
          <option value="2010">2010</option>
          <option value="all" selected>ALL</option>
        </select>
      </td>
      <td>Month
        <select name="mese" onchange="check()" size="1">
          <option value="1">gen</option>
          <option value="2">feb</option>
          <option value="3">mar</option>
          <option value="4">apr</option>
          <option value="5">mag</option>
          <option value="6">giu</option>
          <option value="7">lug</option>
          <option value="8">ago</option>
          <option value="9">set</option>
          <option value="10">ott</option>
          <option value="11">nov</option>
          <option value="12">dec</option>
          <option value="all" selected>ALL</option>
        </select>
      </td>
      <td>Day
        <select name="giorno" onchange="check()" size="1">
          <option value="1">1</option>
          <option value="2">2</option>
          <option value="3">3</option>
          <option value="4">4</option>
          <option value="5">5</option>
          <option value="6">6</option>
          <option value="7">7</option>
          <option value="8">8</option>
          <option value="9">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
          <option value="13">13</option>
          <option value="14">14</option>
          <option value="15">15</option>
          <option value="16">16</option>
          <option value="17">17</option>
          <option value="18">18</option>
          <option value="19">19</option>
          <option value="20">20</option>
          <option value="21">21</option>
          <option value="22">22</option>
          <option value="23">23</option>
          <option value="24">24</option>
          <option value="25">25</option>
          <option value="26">26</option>
          <option value="27">27</option>
          <option value="28">28</option>
          <option value="29">29</option>
          <option value="30">30</option>
          <option value="31">31</option>
          <option value="all" selected>ALL</option>
        </select>
      </td>
    </tr>
  </table>
  <table width="100%" border="0">
    <tr>
      <td height="27">order by
        <select name="order" size="1"  onChange="check()">
          <option value="date" selected>Date</option>
          <option value="name">Username</option>
          <option value="job">Job</option>
        </select>
      </td>
    </tr>
  </table>
  <table width="100%" border="0">
    <tr>
      <td><b><a href="javascript:allusers();">View all the
users</a></b></td>
    </tr>
  </table>
  <p>
    <textarea name="qry" cols="100" rows="5" wrap="VIRTUAL"> </textarea>
  </p>
  <p>
    <input type="submit" name="Submit" value="Submit">
  </p>
</form>
</body>
</html>
Grazie!!!

 il codice javascript :
Ciao!
il tuo codex è:
document.queryform.anno.value
dove anno è il select..........
Se per IE funzia è solo perchè IE la dà a tutti indistintamente , mentre NN
è più malfidente e se non gli dici la parola magica........non te la
dà........
A parte gli scherzi ...........per i select bisogna fare riferimento a
quanto sotto per NN.....
self.document.forms[n].elements[n].options[self.document.forms[n].elements[n
].selectedIndex].value
dove n è il numero degli elementi presenti nella form partendo da 0 in cima
alla pagina.....perciò se anno è il quarto elemento sarà
elements[3].........
____________________
andreotta fabiano
WebMªster ATI POWER s.n.c.
andr...@atipower.it
http://www.atipower.it
http://www.afdsoftware.freeweb.org
____________________


