Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <body>
- <%
- var brands = getBrands(); // output exemplo: ('Opel', 'Renault')
- var cars = getCars(); /* output exemplo: ({brand_name: 'Opel', name: 'Corsa'},
- {brand_name: 'Opel', name: 'Astra'}); */
- %>
- // Lês a lista das marcas para dentro da combobox
- <select id="brands">
- <option></option>
- <% foreach(brands as brand){ %>
- <option value="<% Response.Write(brand); %>">
- <% Response.Write(brand); %>
- </option>
- <% } %>
- </select>
- // Lês a lista dos carros para dentro da combobox
- <select id="cars">
- <option></option>
- <% foreach(cars as car){ %>
- <option value="<% Response.Write(car['name']); %>" data-brand="<% Response.Write(car['brand_name']); %>" style="display: none">
- <% Response.Write(car['name']); %>
- </option>
- <% } %>
- </select>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement