如何在点击按钮/文本时显示信息? [英] How to reveal information when clicking on a button/text?

查看:149
本文介绍了如何在点击按钮/文本时显示信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张桌子,上面写着'See more',写在Trainee Insurance的标题旁边。

我希望人们能够点击查看更多然后信息出现在标题下方



我该如何做?

谢谢!



James

 < table height =20width =775cellpadding = 0cellspacing =0> 
< tr>
< td>
< font face =lucidagrandesize =4color =black>学员保险经纪 - 伦敦< / font>
< td align =right>
< font face =lucidagrandesize =2color =red>查看更多...< / font>
< / td>
< / tr>
< / table>


解决方案

可能还有其他方法 - 非JavaScript方式 - 但我一直使用JavaScript来做到这一点。将 onclick 处理程序添加到查看更多td,并在该处理程序中设置更多元素具有 display:inline style,像这样(未经测试):

 < script type =text / javascript> 
function show_more(element_to_show){
var element_to_show = getRefToDiv(element_to_show);
element_to_show.style.display =inline;
}
< / script>

< table height =20width =775cellpadding =0cellspacing =0>
< tr>
< td>
< font face =lucidagrandesize =4color =black>学员保险经纪 - 伦敦< / font>
< td align =rightonclick =show_more('more');>
< font face =lucidagrandesize =2color =red>查看更多...< / font>
< / td>
< td id =morestyle =display:none;>当他点击时,他会看到这个信息See More ...< / td> ;,
< / tr>
< / table>


I have a table with 'see more' written on the side of the title "Trainee Insurance.."

I want people to be able to click see more and then information appears below the title

How do I do this?

Thanks!

James

<table height="20" width="775" cellpadding="0" cellspacing="0">
<tr>
<td>
<font face="lucidagrande" size="4" color="black">Trainee Insurance Broker - London</font>
<td align="right">
<font face="lucidagrande" size="2" color="red">See More...</font> 
</td>
</tr>
</table>

解决方案

There might be other ways -- non-JavaScript ways -- but I have always used JavaScript to do this. Add an onclick handler to the "see more" td and, in that handler, set the more element to have display:inline style, something like this (untested):

<script type="text/javascript">
function show_more ( element_to_show ) {
var element_to_show = getRefToDiv( element_to_show );
element_to_show.style.display = "inline";
}
</script>

<table height="20" width="775" cellpadding="0" cellspacing="0">
<tr>
<td>
<font face="lucidagrande" size="4" color="black">Trainee Insurance Broker - London</font>
<td align="right" onclick="show_more('more');">
<font face="lucidagrande" size="2" color="red">See More...</font> 
</td>
<td id="more" style="display:none;">The guy will see this when he clicks See More...</td>, 
</tr>
</table>

这篇关于如何在点击按钮/文本时显示信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆