本文介绍了如何使用javascript将下拉列表值下载到另一个页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 各位大家好..我试着用javascript将下拉列表值解析到另一个php页面,但是无法正确...这里是我的代码 dropdown.html: < p > 选择您的号码:< / p > < 选择 名称 = formNumber > < 选项 value = 0 id = getNumber > 选择... < / option > < 选项 value = 1 id = getNumber > 1 < / option > < 选项 value = 2 id = getNumber > 2 < / option > < / select > 和i尝试使用这样的getValue.js获取此页面值: var get1 = document .getElementById( getNumber); var getValue = get1.options [get1.selectedIndex] .value; if (getValue == 0 ){ alert( 请选择一个数字); } 如果(getValue!= 0 ){ // 我想在这里使用ajax来解析showValue.php的值 // 但不知道如何使它成为那样 // 所以我在下面尝试了这段代码 $ .ajax({ type: POST, url: showValue.php, data: getValue = + getValue }); window 。 location = showValue.php; } 这个showValue.php中的我试图显示dropdown.html的值: $ listValue = $ _REQUEST [' getValue']; 打印($ listValue); 但是我在浏览器中从showValue.php得到的回复是 解析错误:语法错误,第2行的C:\ wamp \ test \ showValue.php中的意外'$ listValue'(T_VARIABLE) 有人能告诉我一个方法吗... 解决方案 .ajax({ type: POST, url: showValue.php, data: getValue = + getValue }); window 。 location = showValue.php; } 这个showValue.php中的我试图显示dropdown.html的值: listValue = _REQUEST [' getValue']; print( Hello everyone..I tried to parsing drop down list value to another php page with javascript but can't get it right...here is my codedropdown.html:<p>Select your number :</p><select name="formNumber"> <option value="0" id="getNumber">Select...</option> <option value="1" id="getNumber">1</option> <option value="2" id="getNumber">2</option></select>and i tried to get this page value with getValue.js like this:var get1 = document.getElementById("getNumber");var getValue = get1.options[get1.selectedIndex].value; if (getValue == 0){ alert("Please select a number"); } if (getValue != 0){ //i want to use ajax in here to pars the value to showValue.php //but don't know how to make it that way //so i tried this code below $.ajax({ type: "POST", url: "showValue.php", data: "getValue="+getValue }); window.location= "showValue.php"; }in this showValue.php I tried to show the value of dropdown.html:$listValue = $_REQUEST['getValue'];print($listValue);but the response i get from showValue.php in browser isParse error: syntax error, unexpected '$listValue' (T_VARIABLE) in C:\wamp\test\showValue.php on line 2can anyone show me a way please... 解决方案 .ajax({ type: "POST", url: "showValue.php", data: "getValue="+getValue }); window.location= "showValue.php"; }in this showValue.php I tried to show the value of dropdown.html:listValue =_REQUEST['getValue'];print( 这篇关于如何使用javascript将下拉列表值下载到另一个页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 02:16