Gooden Posted December 7, 2007 at 04:57 PM Report Share #152902 Posted December 7, 2007 at 04:57 PM Bom tou a tentar fazer um codigo k ao clicar no butao ele vai para uma pagina <html> <head> <SCRIPT LANGUAGE="javascript"> function OnChange(dropdown) { var baseURL =dropdown; top.location.href = baseURL; } </SCRIPT> </head> <body> <select name='select9'> <option></option> <option value="9">aa€</option> <option value="10">aaa €</option> <option value="11">aaaa €</option> <option value="12">aaaaa €</option> <option value="141">aaaaaa €</option> </select> <input type="submit" value="Comprar" NAME="btn9" onClick="OnChange(select9.value)" style="background-color:#EFA915;"> </body> </html> codigo n sei porque n funciona o esquizito e quando uso onchange na select box ele funfa LOOL? Link to comment Share on other sites More sharing options...
softklin Posted December 7, 2007 at 05:27 PM Report Share #152916 Posted December 7, 2007 at 05:27 PM Porque tens de indicar a referencia completa para o objecto. no submit, passa à tua função isto: document.getElementsByName("select9")[0].value ou seja, fica OnChange(document.getElementsByName("select9")[0].value) a função getElementsByName retorna um array dos elementos com esse nome, como só há um, assuma a primeria posição, daí o [ 0 ]. Podes ver mais sobre o getElementsByName no site da w3schools. Nick antigo: softclean | Tens um projeto? | Wiki P@P Ajuda a comunidade! Se encontrares algo de errado, usa a opção "Denunciar" por baixo de cada post. Link to comment Share on other sites More sharing options...
Gooden Posted December 7, 2007 at 06:27 PM Author Report Share #152941 Posted December 7, 2007 at 06:27 PM ja ta resolvido 🙂 BRigado soft 🙂 Depois pagote uma jola 😁 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now