david_carlos Posted April 23, 2015 at 10:53 AM Report Share #581695 Posted April 23, 2015 at 10:53 AM (edited) Boas, precisava que depois da combobox ser seleccionada mantive-se na selecção. <form action="" method="post" > <select name="cb_tabelas" id="cb_tabelas" onchange="window.location = this.options[this.selectedIndex].value"> <option value="0">--Selecionar Categoria--</option> <option value="index.php?site=editar&id=1">Marcas</option> <option value="index.php?site=editar&id=2">Produtos</option> <option value="index.php?site=editar&id=3">Projectos</option> <option value="index.php?site=editar&id=4">Promoções</option> <option value="index.php?site=editar&id=5">Enventos</option> <option value="index.php?site=editar&id=6">Nossas Marcas</option> </select> <input name="editar" type="button" value="Editar" /> Edited April 23, 2015 at 12:21 PM by apocsantos geshi Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted April 23, 2015 at 11:19 AM Report Share #581701 Posted April 23, 2015 at 11:19 AM podes fazer o favor de ser mais descritivo na tua dúvida ? IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
david_carlos Posted April 23, 2015 at 11:32 AM Author Report Share #581703 Posted April 23, 2015 at 11:32 AM Por exemplo eu ao escolher uma opçao ele neste momento esta a mandar o id para o url mas nao se mantem selecionado. Tipo escolho marca o url fica index.php?site=editar&id=1 ate aqui ok dpois na combobox volta para a opcao 0 Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted April 23, 2015 at 11:36 AM Report Share #581706 Posted April 23, 2015 at 11:36 AM estás a usar alguma linguagem server-side para construir o teu HTML ? IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to comment Share on other sites More sharing options...
david_carlos Posted April 23, 2015 at 11:49 AM Author Report Share #581708 Posted April 23, 2015 at 11:49 AM nao Link to comment Share on other sites More sharing options...
HappyHippyHippo Posted April 23, 2015 at 12:10 PM Report Share #581710 Posted April 23, 2015 at 12:10 PM então a única solução é usar javascript usando o seguinte código: http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } deverás registar a seguinte função a ser executada no momento que a página se encontra carregada function setSelectValue() { var element = document.getElementById('cb_tabelas'); element.value = getParameterByName('id'); } IRC : sim, é algo que ainda existe >> #p@p Portugol Plus 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