html - Javascript anchor href change and form post -


i have form coded below. href value anchor tag determined value selected in dropdown.

<form name=xyz method=post>   //random stuff    <a href="#" onclick="setanchor()">     //some image   </a> </form> 

i setting href property of form in javascript this:

if(dropdown.option selected = "x")     windows.location.href = url; else     windows.location.href = url; 

the problem having using windows.location causes form use method. code expects post method continue.

how can fix this? not married above method. way can set form action url, based on option selected user, work me.

if have form:

<form id="myform" action="page.php" method="post"> 

you can submit (with post method) (that is, instead of window.location...) so:

document.getelementbyid("myform").submit(); 

you can set url submited this

document.getelementbyid("myform").action = "page.php"; 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -