Gere um formulário da Web moderno usando HTML e JavaScript.
É possível consultar um modelo diretamente e testar os resultados retornados ao usar diferentes valores de parâmetros com o console do Cloud ou ao chamar a API Vertex AI diretamente.
|
|||||||||||
Comando Formato livre
Gerar um formulário da Web usando HTML e JavaScript para que os clientes demonstrem interesse no nosso produto. O formulário deve coletar os nomes e endereços de e-mail dos clientes e como eles nos conheceram. O formulário deve refletir as tendências modernas do web design.
RespostaFormulário da Web moderno para manifestaçãoEste código fornece uma estrutura básica para um formulário da Web moderno usando HTML e JavaScript. É possível personalizar ainda mais o estilo usando CSS para se alinhar à sua marca e preferências específicas. HTML (index.html): <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Express Interest</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container"> <h2>Express Your Interest</h2> <p>Tell us a little about yourself and we'll be in touch!</p> <form id="interest-form"> <div class="form-group"> <label for="name">Name:</label> <input type="text" id="name" name="name" required> </div> <div class="form-group"> <label for="email">Email:</label> <input type="email" id="email" name="email" required> </div> <div class="form-group"> <label for="discovery">How did you hear about us?</label> <select id="discovery" name="discovery"> <option value="">Select an option</option> <option value="search">Search Engine</option> <option value="social">Social Media</option> <option value="friend">Friend or Colleague</option> <option value="other">Other</option> </select> </div> <button type="submit">Submit</button> </form> </div> <script src="script.js"></script> </body> </html> JavaScript (script.js): const form = document.getElementById('interest-form'); form.addEventListener('submit', (event) => { event.preventDefault(); // Prevent default form submission // Here you would typically collect the form data and send it to your server // using Fetch API or similar methods. // For demonstration, we'll just log the data to the console: const formData = new FormData(event.target); const name = formData.get('name'); const email = formData.get('email'); const discovery = formData.get('discovery'); console.log('Name:', name); console.log('Email:', email); console.log('Discovery:', discovery); // You can add code here to display a success message or redirect to a thank you page }); CSS (style.css): /* Basic styling - customize to your needs */ .container { max-width: 500px; margin: 20px auto; padding: 20px; border: 1px solid #ccc; border-radius: 5px; } .form-group { margin-bottom: 15px; } label { display: block; margin-bottom: 5px; } input, select { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 3px; } button { background-color: #4CAF50; /* Green */ border: none; color: white; padding: 10px 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; border-radius: 3px; cursor: pointer; } Explicação:
Tendências de design moderno:
Outras melhorias:
|
|