我对javascript很新,我需要一些指导。我有一个显示一些数据的表,表的源代码就是这个。
function user_clients_table_storagefolder() {
$con = mysql_connect("localhost","root",'');
if(!$con){
die("Cannot Connect" . mysql_error());
}
mysql_select_db("client_app",$con);
$get_user_clients = "SELECT `ID`,`Name`,`SurName`,`storagefolder` FROM `clients` ";
$clients = mysql_query($get_user_clients,$con);
echo "<table class=table table-condensed>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>SurName</th>
<th>Recipient</th>
</tr>
</thead>";
while($record = mysql_fetch_array($clients)){
echo "<action=pushnotification.php method=post>";
echo "<tr>";
echo "<td>".$record['ID']." </td>";
echo "<td>".$record['Name']." </td>";
echo "<td>".$record['SurName']." </td>";
echo "<td>"."<button type=button id=contact class=btn btn-primary value=".$record['Name'].">Primary</button></td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
//function that is used to display the table of all the clients and fetch back the storagefolder of each user
}
每个表行在最后一个列中都有一个具有不同值的按钮。当我单击任何按钮时,会显示一个弹出窗体,要求上传文件。表单的源代码如下:
<div id="contactForm">
<p><h4><font color="white"><i>First Choose the clients and then the file which will be uploaded in order to proced</i></font></h4></2>
<p> </p>
<input type="file" class="upload" name="onstorage" id="upload_file" size="50" name="icon" onchange="loadFile(this);" >
<hr>
<div id="myProgress">
<div id="myBar"></div>
</div>
</div>
启动弹出窗口的代码如下:
<script>
$(function() {
// contact form animations
$('#contact').click(function() {
$('#contactForm').fadeToggle();
})
$(document).mouseup(function (e) {
var container = $("#contactForm");
if (!container.is(e.target) // if the target of the click isn't the container...
&& container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.fadeOut();
}
});
});
</script>
每次我选择一个不同的文件来上传函数loadfile()被调用,它正在发送我上传的输入值。我的问题是,我怎样才能传递已按下的按钮的值功能相同?
有人可以帮帮我吗? 谢谢你的问候