早上好伙计们,我正在尝试学习 jquery,并且从我从 js 中知道的帽子,这应该可以工作,但它不是......基本上点击提交按钮,它应该改变内部 html。有更多经验的人有什么想法吗?
jQuery:
$(function() {
$("#submitButton").click(function(){
reply();
})
});
function reply(){
document.getElementById("#progressBar").innerHTML = "worksbro";
}
html:
<button type="button" id="submitButton">Submit</button>
如果我没记错的话,这应该有效。它应该改变progressBar
但 onclick 什么都不做
为了消除一些混乱:
<div id = "progressBar"></div>
所有代码:
<!DOCTYPE html>
<html>
<head>
<script src="theJS.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#submitButton").click(function(){
reply();
})
});
function reply(){
$("progressBar").html("worksbro");
}
</script>
<title>
One neat van page
</title>
</head>
<body>
<div id="tableone">
<?php
//connect to db
include 'connect.php';
//start the table float left
cho '<table>';
echo '<tr><td style="background-color:#03899C; color:white; text-align:center;">Driver</td>
<td style="background-color:#03899C; color:white; text-align:center;">Van</td></tr>';
//lets get dem drivers and vans
//actually just the vans, realistically.
$sql= 'SELECT *
FROM Vans';
//make a table float let with driver name and an info(keep it simple)
foreach($conn->query($sql) as $row) {
echo '<tr id="'.$row['Owner'].'" style="cursor:pointer;" onClick="more(this.id)">';
echo "<td style=\"background-color:#FFFC00;\"><a href=#>".$row['Owner']."</a></td>";
echo "<td style=\"background-color:#FFFC00;\">".$row['Year']." ".$row['Make']." ".$row['Model']."</td>";
echo '<tr>';
}
echo '</table>';
?>
</div>
<div id="more">
<div id="edit"></div>
<h1 id="van"><u>More Info</u></h1>
<div id="vanList">
</div><!--end vanList-->
</div>
<div id = "progressBar">
<progress value="0" max="100"></progress>
</div>
<div id="innactive">
<h3>Innactive Vans</h3>
<table>
<?php
//connect to the database
include 'connect.php';
//get inactive vans
//my brain is mush right now, so bear with me...
$sql = "SELECT *
FROM Vans
";
foreach($conn->query($sql) as $row) {
if (!empty($row['Innactive'])){
echo '<tr><td style="background-color:#03899C; color:white; text-align:center;">Driver</td>
<td style="background-color:#03899C; color:white; text-align:center;">Van</td></tr>';
echo '<tr id="'.$row['Owner'].'" style="cursor:pointer;" onClick="more(this.id)">';
echo "<td style=\"background-color:#FFFC00;\"><a href=#>".$row['Owner']."</a></td>";
echo "<td style=\"background-color:#FFFC00;\">".$row['Year']." ".$row['Make']." ".$row['Model']." </td>";
echo '</tr>';
}
}
?>
</div>
</body>
</html>