PHP JavaScript 未捕获错误与 onchange
PHP JavaScript uncaught error with onchange
我有下拉列表,当有人选择我需要提交的东西时,这是我的代码:
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<body bgcolor="#E2E2E2">
<form action='index.php' method='post' enctype='multipart/form-data' id='myform'>
<div div style="position: absolute;left: 35%; top: 30%;">
<link rel="stylesheet" type="text/css" href="CSS.css">
<?php
include ("config.php");
// Create connection
//form start
if ($result->num_rows > 0) {
// output data of each row
echo"<tr><td>формат: ";
echo"<select class='format' name='formater'onchange='document.getElementById('myform').submit()'>";
while($row = $result->fetch_assoc()) {
echo "<option value='". $row["$formatPrice"]. "'>".$row["$formatColumn"]. "</option>";
}
}
if(isset($_POST['submit'])){
echo "aaa";
}
?>
当我选择选项时出现错误:未捕获的类型错误:对象不是更改的函数感谢您的任何帮助。
以下是呈现的 html:
<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head><body bgcolor="#E2E2E2">
<form action="client.php" method="post" enctype="multipart/form-data" id="myform">
<div div="" style="position: absolute;left: 35%; top: 30%;">
<link rel="stylesheet" type="text/css" href="CSS.css">
<table border="1px" class="table"><tbody><tr><td>Calculator </td></tr> <tr><td>ფორმატი: <select class="format" name="formater" onchange="document.getElementById(" myform').submit()'=""><option value="0.15">A3</option><option value="0.1">A4</option><option value="0.05">A5</option><option value="0.035">A4/3</option>aaa</select></td> </tr><tr><td><input type="submit" name="submit" class="btn" value="Submit"></td> </tr>
</tbody></table></div></form></body></html>
所以在将这个问题标记为重复之后,昆汀向我展示了JavaScript中的这个链接"提交不是一个函数"错误是的,这绝对是另一回事,这些答案对我没有帮助,我认为它在 PHP 中比在 js 中更多,因为我在没有 PHP 的情况下尝试了这段代码并且它有效......现在我对此越来越困惑!
我会给表单一个 ID 以便更容易识别它
<form action='index.php' method='post' id='myform' enctype='multipart/form-data'>
然后将其用于您的 OnChange 事件
onchange='document.getElementById("myform").submit()'
我不确定您的格式是否有问题。尝试。。。
<form action="index.php" method="post" id="myform" enctype="multipart/form-data">
<?php
echo "<select class='"format'" name='"formater'" onchange='"document.getElementById('myform').submit()'">";
while($row = $result->fetch_assoc()) {
echo "<option value='"" . $row['$formatPrice'] . "'">" . $row['$formatColumn'] . "'"</option>";
}
?>
相关文章:
- Node.js v6.2.0类扩展不是函数错误
- Jquery菜单操作不稳定,定位不正确,存在一般错误
- document.open/document.write没有正确地清除chrome中的文档——这是chrome的错误吗
- 试图在引导模式内动态生成图表,得到offsetWidth错误
- 为什么会出现错误;未捕获的类型错误:undefined不是函数;
- 我如何修复包含在captcha的addthis中的错误
- 同样,同样的错误'ahorcado.js:26未捕获类型错误:无法读取属性'beginPath'
- 节点是否需要模块传递带有方括号的arg?这是个错误吗
- Webpack/Rect:遵循egghead.io教程,但出现错误:您可能需要一个合适的加载程序来处理此文件类型
- CKFinder 3为所选文件返回错误的URL
- javascript onchange取消绑定错误|未定义
- 未捕获的引用错误:函数未使用 onchange 定义
- 将服务中的函数绑定到$scope(错误:无法设置undefined的属性'onChange')
- PHP JavaScript 未捕获错误与 onchange
- 通过 onchange 事件传递值时未捕获的引用错误
- 从属YII输入框?我的错误在哪里?如何在dropDownList中添加Onchange事件?而无需使用控制器
- Onchange集合获取错误而不是函数
- JavaScript +无效参数错误与fireEvent('onchange')
- 动态下拉菜单在调用 onchange 函数时获取错误的值
- 为我的 HTML 表单收到 onChange 空错误