Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.     <head>
  3.     </head>
  4.     <body>
  5.         <%
  6.             var brands = getBrands();   // output exemplo: ('Opel', 'Renault')
  7.             var cars   = getCars();     /* output exemplo: ({brand_name: 'Opel', name: 'Corsa'},
  8.                                         {brand_name: 'Opel', name: 'Astra'}); */
  9.            
  10.         %>
  11.  
  12.         // Lês a lista das marcas para dentro da combobox
  13.         <select id="brands">
  14.             <option></option>
  15.            
  16.             <% foreach(brands as brand){ %>
  17.  
  18.             <option value="<% Response.Write(brand); %>">
  19.                 <% Response.Write(brand); %>
  20.             </option>
  21.            
  22.             <% } %>
  23.  
  24.         </select>
  25.        
  26.         // Lês a lista dos carros para dentro da combobox
  27.         <select id="cars">
  28.             <option></option>
  29.            
  30.             <% foreach(cars as car){ %>
  31.  
  32.             <option value="<% Response.Write(car['name']); %>" data-brand="<% Response.Write(car['brand_name']); %>" style="display: none">
  33.                 <% Response.Write(car['name']); %>
  34.             </option>
  35.            
  36.             <% } %>
  37.  
  38.         </select>
  39.  
  40.     </body>
  41. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement