在 PHP 中选项卡?

编程入门 行业动态 更新时间:2024-10-07 01:33:12
本文介绍了在 PHP 中选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我的页面上有这些标签

装备 |税|平衡 |债务|基金 |ETF |镀金......

Equ | Tax | Balanced | Debt | Funds | ETF | Gilt .......

然后在这些选项卡下方有空间.当用户单击这些选项卡时,必须在该空间中显示与这些选项卡相对应的数据,而不会更改页面的 url.就像我单击 Equ 时一样,它的数据将显示在该空间中,如果我单击税则其数据将显示在相同的空间中,就像它覆盖了以前的数据一样.必须显示的数据是使用 php 计算的.现在使用 php 或 javascript 最简单的方法是什么???

and then there's space below these tabs. When user clicks on these tabs then a data corresponding to these tabs has to be displayed in that space without changing the url of the page.Like when i click Equ then its data will be displayed in that space ,if i click tax then its data will be displayed in that same space as if it has overwritten the previous data.The data that has to e shown is calculated using php. Now what is the easiest way to do so using php or javascript ???

这里有一些编码帮助将不胜感激.

some coding help would be appreciated here .

看到我知道这可以使用 javascript 来完成,但必须显示的数据在 php 变量中.现在如何将 php 变量分配给 javascript????

see i know this can be done using javascript but the data that has to be shown is in php variable .Now how to assign a php variable to javascript????

<script type="text/javascript">
function showhide(ref)
{
    document.getElementById('mf').innerHTML= HERE I WANT A PHP VARIABLE;
}
</script>

如何在 onclick 事件中发送我的 pfp 变量,以便它们可以在函数中使用???

how can i send my pfp variables in onclick event so that they can be used in the function???

推荐答案

您可以使用 CSS 或/和 Javascript 来帮助您解决问题.

You may use CSS or/and Javascript to help you do the trick.

仅使用 CSS 的选项卡示例:

Example of tabs using CSS only:

http://edeverett.co.uk/experiments/css_only_tabs.html

使用 Javascript 的选项卡示例:

Example of tabs using Javascript:

http://jqueryui/demos/tabs/

编辑作为对您的编辑的回复:

Edit As reply to your edit:

我知道这可以使用 javascript 完成,但必须显示的数据在 php 变量中.现在如何将 php 变量分配给 javascript ????

see i know this can be done using javascript but the data that has to be shown is in php variable .Now how to assign a php variable to javascript????

要在服务器端同步执行所有操作,您可以将计算结果注入到您的 javascript 中:

To perform everything on server-side synchronously, you can inject calculated result into your javascript:

function showhide(ref)
{
    document.getElementById('mf').innerHTML= '<?php echo $variable; ?>';
}

更好的做法是使用 AJAX.

A better practise would be to use AJAX.

这篇关于在 PHP 中选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-05-01 10:48:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1408600.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:选项卡   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!