我在页面上有以下链接结构(导航栏):
<table border="0">
<tr>
<td><?php if ($pageNum_get_thumbs > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_get_thumbs=%d%s", $currentPage, 0,
$queryString_get_thumbs); ?>"><img src="First.gif" /></a>
<?php } // Show if not first page ?></td>
<td><?php if ($pageNum_get_thumbs > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_get_thumbs=%d%s", $currentPage,
max(0, $pageNum_get_thumbs - 1), $queryString_get_thumbs); ?>"><img
src="Previous.gif" /></a>
<?php } // Show if not first page ?></td>
<td><?php if ($pageNum_get_thumbs < $totalPages_get_thumbs) { // Show if
not last page ?>
<a class="nav_link" href="<?php printf("%s?pageNum_get_thumbs=%d%s",
$currentPage, min($totalPages_get_thumbs, $pageNum_get_thumbs + 1),
$queryString_get_thumbs); ?>"><img src="Next.gif" /></a>
<?php } // Show if not last page ?></td>
<td><?php if ($pageNum_get_thumbs < $totalPages_get_thumbs) { // Show if
not last page ?>
<a href="<?php printf("%s?pageNum_get_thumbs=%d%s", $currentPage,
$totalPages_get_thumbs, $queryString_get_thumbs); ?>"><img
src="Last.gif" /></a>
<?php } // Show if not last page ?></td>
</tr>
</table>
有没有人可以点击任何链接而无需刷新整个页面?这就是页面上的样子:
How to force a components rerendering in angular2
我尝试了各种网站的Ajax(onclick GET方法)和其他建议,但我没有运气。
答案 0 :(得分:0)
将点击事件绑定到链接并在href中传递javascript:void(0)。如下所示,这将停止刷新页面。
<a href="javascript:void(0)" onclick="yourFunction(params)"><img src="First.gif" /></a>
并在代码中创建yourFunction(params)。
javascript:void(0)将停止刷新页面。点击链接后onclick会被触发,你可以在那里写下你剩下的逻辑。
您可以编写如下所示的链接。
<a href="javascript:void(0)" onclick="yourFunction(<?php printf("%s?pageNum_get_thumbs=%d%s", $currentPage, 0,
$queryString_get_thumbs); )"><img src="First.gif" /></a>
功能如下。
function yourFunction(params){
window.location.href = params;// or any other logic as per your requiriement;
}
答案 1 :(得分:0)
这是有用的:
我添加了一个名为params的变量:
for file_ in allFiles:
parsed_file = read_workbook(file_)
parsed_file['filename'] = os.path.basename(file_)
parsed_file.set_index(0, inplace = True)
parsed_file.index.str.strip()
try:
Staff_ = parsed_file.loc["Staff" : "Total Staff"].copy()
# Line below won't be executed in case of an exception
list_.append(Staff_)
except KeyError:
print(file_)
frame = pd.concat(list_)
然后将链接更改为:
$params = explode("&", $_SERVER['QUERY_STRING']);
然后我添加了Jquery脚本:
<a onclick="next_slide('<?php printf("%s?pageNum_get_thumbs=%d%s",
$currentPage, min($totalPages_get_thumbs, $pageNum_get_thumbs + 1),
$queryString_get_thumbs); ?>')" href="#">Next</a>
所有图像都位于容器DIV中,一次重复三次。
瞧!有用!希望这可以帮助将来的某个人,并防止他们对抗$ devrocks