javascript - GetelementbyId from selected Value -


I have a script that obtains a parameter and updates the table in a MySQL database. I want to execute that script with javscript and a button. But that button does not work.

  $ abfrage = "pending selection"; $ Erbbinis = iscl_query ($ abbenz); Echo & lt; Script & gt; Function showid (str) {if (str == "") {document.getElementById ("txtHint") InnerHTML = ""; Return; } If (window.XMLHttpRequest) {// code for IE7 +, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest (); } Else {// code for IE6, IE5 xmlhttp = new ActiveXObject ("Microsoft.XMLHTTP"); } Xmlhttp.onreadystatechange = function () {if (xmlhttp.readyState == 4 & xmlhttp.status == 200} {document.getElementById ("txtHint"). InnerHTML = xmlhttp.responseText;}} Xmlhttp.open (" GET "," getusr.php? Q = "+ str, true); xmlhttp.send ();} function status (str) {xmlhttp.open (" get "," getusr.php? Status = "+ str, true ); Xmlhttp.send ();} & lt; / script & gt; 'echo' 
& lt; id = "selectid" name = "id" onchange = "showid (this.value ); Size = 1>;; echo '& lt; option value = "" & gt; id and ausw & auml; hlen & lt; / option & gt;'; while ($ row = mysql_fetch_object ($ ergebnis) ) {Echo '& lt; option value =' '. $ Row-> ID. "" & Gt; $ line- & gt; ID' & lt; / option & gt; ';} echo' lt; / select & gt; & lt; input "=" Button "name =" button1 "value =" accept "onClick =" statusa (getElementById ("selectid"). SelectedIndex) "/> ; echo & lt; Div id = "txthint" & gt; & lt; / div & gt; ';} fi {echo' & lt; html & gt; & Lt; Form action = "setstatus.php" method = "post" & gt; & Lt; Input type = "password" name = "pw" & gt; & Lt; Input type = "submit" value = "submit" & gt; & Lt; / Form & gt; & Lt; / Html & gt; '; }

The getusr.php script works, when I use it with the GET parameter only does not work on the button.

Thank you in advance for your help

button to the index of selected option Retrieves, not the value of the selected option In addition, you need to avoid quotation marks around the selectid , otherwise eliminating the string at the beginning of any attribute.

  onClick = "statusa (document.getElementById) (\" Selectid \ "). Value)    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -