Forum de discussion
Forum « Programmation ASP » (archives)
Re: Liste déroulante avec ASP
Envoyé: 7 mai 2005, 6h05 par Salem
<form name="f">
<select name="s" onChange="document.f.prenom.value=prenoms[this.selectedIndex];document.f.adresse.value=adresses[this.selectedIndex];">
<option value="0">Faites un choix</option><%
rs.open "select id, first_name, last_name, email from logins where active = 1 and id > 0 order by last_name", cnn
array_prenom = "''"
array_adresse = "''"
do while not rs.eof
array_prenom = array_prenom & ", '" & replace(rs("first_name"), "'", "\'") & "'"
array_adresse = array_adresse & ", '" & replace(rs("email"), "'", "\'") & "'"
%><option value="<% =rs("id") %>"><% =rs("last_name") %></option><%
rs.movenext
loop: rs.close
%></select>
<input type="text" name="prenom">
<input type="text" name="adresse">
</form>
<script language="JavaScript" type="text/javascript">
prenoms = new Array(<% =array_prenom %>);
adresses = new Array(<% =array_adresse %>);
</script>
Réponses
|