html - Reload the page with parameter triggered by JavaScript dropdown change event -


I want to reload a form and select it with the selection. I have an HTML form here:

  & lt; Form name = 'vehicleform' & gt; & Lt; Select Name = 'Vehicle List' & gt; & Lt; Option value = '' & gt; Select & lt; / Options & gt; & Lt; Option value = 'just' & gt; Just & lt; / Options & gt; & Lt; Option value = 'bike' & gt; Bike & lt; / Options & gt; & Lt; Option value = 'car' & gt; Car & lt; / Options & gt; & Lt; / Select & gt; & Lt; Input type = 'text' name = 'on' & gt; & Lt; / Input & gt; & Lt; / Form & gt;  

When the user first opens the page, the dropdown box is at the option Select and the text box (current) will be empty

< P> When the user selects any option from the dropdown, then the page needs to be reloaded and that dropdown item should be selected and the value of that dropdown should be in the text input field.

What is the need to do this in the javascript function?

like this:

  & lt; Name Select name = 'MondayName' id = "main" onchange = "document.location.href = 'page.php? Var =' + this.value" & gt; & Lt; Option value = '' & gt; Select & lt; / Options & gt; & Lt; Option value = 'just' & gt; Just & lt; / Options & gt; & Lt; Option value = 'bike' & gt; Bike & lt; / Options & gt; & Lt; Option value = 'car' & gt; Car & lt; / Options & gt; & Lt; / Select & gt; & Lt; Script type = "text / javascript" & gt; Document.getElementById ('myid'). Value = "& lt ;? Php echo $ _GET ['var'];? & Gt;"; & Lt; / Script & gt;  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -