javascript - 跨度文本更改后页面变白?
问题描述
我有一个简单的 PHP 文件,它获取数据并将其显示在表格中。
当我使用按钮更改跨度文本时,页面变为白色。控制台中没有错误。当我向任何按钮添加功能或使用脚本更改某些内容时,也会发生这种情况。此外,当我按下提交按钮时,必须发送表单,然后页面必须自行刷新,但它也会返回一个白页。可能是什么问题呢?
<?php
$connect = mysqli_connect($dbhost, $dbuser, $dbpass, $db_name);
mysqli_set_charset($connect,"utf8");
?>
<!DOCTYPE html>
<html>
<body>
<form name="frmContact" method="post" action="denekkayit.php">
<?php
$result = mysqli_query($connect,"SELECT * FROM ****");
?>
<table id="example" class="table is-striped" style="width:100%">
<button type="submit" class="mdc-button mdc-button--stroked" onclick="spantext()">
<i class="material-icons mdc-button__icon">grid_view</i>
<span id="msg" class="mdc-button__label">Edit</span>
</button>
<input type="submit" name="Submit" id="Submit" value="Submit">
<thead>
<tr>
<th ></th>
<th >AAAAA</th>
<th >BBBBBB</th>
</tr>
</thead>
<tbody>
<?php
$j=0;
while ($row = mysqli_fetch_assoc($result))
{
echo
"
<tr>
<td></td>
<td ><input type='text' id='ptwonumber[$j]' name='AAAA[$j]' value={$row['AAAA']}></td>
<td ><input type='text' id='wonumber[$j]' name='BBBB[$j]' value={$row['BBBB']}></td>
</tr>";
$j=$j+1;
};
?>
</tbody>
</table>
</form>
</body>
</html>
<script>
function spantext()
{
if($('#msg').text()=="Edit")
{$('#msg').text("Exit")}
else {$('#msg').text("Edit")}
}
$(document).ready(function() {
$('#example').DataTable( {
columnDefs: [ {
width: 50,
orderable: false,
className: 'select-checkbox',
targets: 0
} ],
select: {
style: 'multi',
selector: 'td:first-child'
},
"scrollY": screen.height/2.2,
"scrollX": true,
order: [[ 1, 'asc' ]]
} );
} );
</script>
解决方案
推荐阅读
- r - 嵌套 for 循环到函数和 lapply
- reactjs - ReactJS 中的箭头函数歧义
- ruby - 无法使用 cucumber 运行 ruby 自动化文件 - 无法加载此类文件 - capybara (LoadError)
- ruby-on-rails - 由于库版本不兼容,无法创建 Rails 应用程序 - 加载错误
- mongodb - 如何从 Mongo DB 中的数组中提取数组
- python - 库中的语法错误无法导入 kafkaProducer
- android - 错误:未找到:“dart:js”导入“dart:js”;
- javascript - GraphQL 将字符串转换为 args 中的浮点数
- python - 创建一个包含多个用户输入的字符串
- java - 无法序列化具有 Hashtable 作为 Jersy restful 服务中的属性的对象