如何将超链接行为从双击更改为单击 [英] How to change hyperlink behavior from double-click to single-click
本文介绍了如何将超链接行为从双击更改为单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码,我希望只需单击一下即可打开我的链接.一切正常,仅此而已,删除,批准蚂蚁不批准链接必须双击才能运行其功能.我希望有人能听到我的声音.
here is my code, i would like my links to open with just a single click. all is functioning properly, its just that, the delete,approve ant not approve link must be double click for its function to run. i hope someone could hear me.
index.php
<?php
$search = '%';
$fgmembersite->DBLogin();
$limit = 5;
if(isset($_GET['offset'])) {
$offset = mysql_real_escape_string($_GET['offset']);
} else {
$offset = 0;
}
//for namelist a-z
$listname = '%';
If (isset($_GET['namelist']))
{
$listname = $_GET['namelist'];
}
//for search file
if(isset($_POST['searchfile']))
{
$search = $_POST['searchfile'];
}
else if(isset($_GET['searchfile']))
{
$search = $_GET['searchfile'];
}
if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa' OR $_SESSION[$fgmembersite->GetLoginSessionVar()] == 'admin')
{
$sql="select * from gmdc_employee where employee_name like '%$search%' AND employee_name like '$listname%' ";
}
else
{
$sql = "select b.* from gmdc_user a, gmdc_employee b where a.username = '".$_SESSION[$fgmembersite->GetLoginSessionVar()]."' and a.company_id = b.company_id AND b.employee_name like '$listname%' AND b.employee_name like '%$search%'";
}
$query = mysql_query("$sql ORDER BY employee_name,confirmation DESC ,file_id DESC,file_date DESC LIMIT $offset,$limit") or die ( mysql_error () );
$result = mysql_query($sql) or die (mysql_error());
$total = mysql_num_rows($result);
if(!$result || mysql_num_rows($result) <= 0)
{
$fgmembersite->HandleError("No file found.");
return false;
}
while ($row = mysql_fetch_assoc($query))
{
$file_id = $row['file_id'];
$file_desc = $row['file_description'];
$file_date = $row['file_date'];
$file_name = $row['file_name'];
$file_accs = $row['folder_access'];
$file_employee = $row['employee_id'];
$file_confir = $row['confirmation'];
$file_ename = ucwords($row['employee_name']);
$info = pathinfo($file_name);
$file_ext = $info['extension'];
echo '<tr>
<td>
</td>
</tr>
<tr class="subone">
<td class="sub" width="100">
'.$file_employee.'
<br />
</td>';
if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa')
{
?><td class="sub" width="100">
<a href="" onclick = javascript:newPopup('addfile.php?emp=<?php echo $file_employee ?>');><?php echo$file_ename?></a>
<br />
</td><?php
}
else
{
echo '<td class="sub" width="182">
'.$file_ename.'
<br />
</td>';
}
echo'<td class="sub" width="218">
<a href="'.$file_accs.$file_name.'" target="_blank" style="text-decoration: underline;">'.$file_desc.'</a>
<br />
</td>
<td class="sub" width="100">
'.date('M d, Y',mktime(0,0,0,substr($file_date,5,2),substr($file_date,8,2),substr($file_date,0,4))).'
<br />
</td>
<td class="sub" width="100">
'.$file_confir.'
<br />
</td>';
if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'sa')
{
if($file_confir == 'Pending' OR $file_confir == 'NotApproved')
{
if(isset($_GET['id']))
{
$fgmembersite->Delete_Db($_GET['id']);
}
echo '<td class="sub" width="100">
<a href="index.php?id='.$file_id.'">Delete</a>
<br />
</td>';
}
}
else if($_SESSION[$fgmembersite->GetLoginSessionVar()] == 'admin')
{
if($file_confir == 'Pending')
{
if(isset($_GET['yes']))
{
$fgmembersite->UpdateYesDB($_GET['yes']);
}
else if(isset($_GET['no']))
{
$fgmembersite->UpdateNoDB($_GET['no']);
}
echo'<td class="sub" width="100">
<a href="index.php?yes='.$file_id.'">Approve</a>
<br /><br />
<a href="index.php?no='.$file_id.'">NotApprove</a>
</td> ';
}
}
}?>
*fg_membersite.php*
function Delete_Db($id)
{
$ok = mysql_query("DELETE FROM gmdc_employee WHERE file_id='$id'");
if (!$ok)
{
$this->HandleError("Error deleting profile from database!");
}
}
function UpdateYesDB($fid)
{
$this->DBLogin();
$yes = mysql_query("UPDATE gmdc_employee SET confirmation='Approved' WHERE file_id = '$fid'");
if (!$yes)
{
$this->HandleError("Error updating from database!");
return false;
}
}
function UpdateNoDB($fids)
{
$this->DBLogin();
$no = mysql_query("UPDATE gmdc_employee SET confirmation='NotApproved' WHERE file_id = '$fids'");
if (!$no)
{
$this->HandleError("Error updating from database!");
return false;
}
}
*注意,我只放置了删除/批准/不批准功能,因为那是我唯一的问题.谢谢
*note, i only put the delete/approve/not approve function because thats my only problem. thanks
推荐答案
请修改小节中的引用用法如下.
Please modify the quote usage in the section as follows.
echo "<td class='sub' width='100'><a href='index.php?yes=".$file_id."'>Approve</a><br /><br /><a href='index.php?no=".$file_id."'>NotApprove</a></td>";
如果您需要任何说明,请告诉我.
Please let me know if you need any clarification.
这篇关于如何将超链接行为从双击更改为单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文