帮忙解决,谢谢!!!!

yinschao1 2010-01-22 01:39:08
一共有3个文字链接,怎样点击其中的一个链接后文字变粗,另两个不变粗?反之亦然?
效果如http://www.4world.pl/categories/kategoria/29这个网站的产品列表,当鼠标放上去,文字链接变大,点击后,文字链接还是变大,当点击其他的文字连接后,原来点击过的文字链接恢复原形,新点击的文字链接就变粗了。谢谢
...全文
85 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
msdnlu 2010-01-22
  • 打赏
  • 举报
回复
onclick=fucntion(this){
document.getElementsByTagName('input')[0].style.fontWeight='normal';
document.getElementsByTagName('input')[1].style.fontWeight='normal';
document.getElementsByTagName('input')[2].style.fontWeight='normal';
this.style.fontWeight='bold'; }
yinschao1 2010-01-22
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 ltnrain 的回复:]
楼主你的给的那个网站点击链接后url变了,就是页面刷新了,在具体的页面哪里直接把当前项的链接设置成加粗的。。如果是同一个页面需要根据参数来设置。
[/Quote]在具体的页面哪里直接把当前项的链接设置成加粗的?但是那些页面都是动态的,如何编写?谢谢
草根醉秋意 2010-01-22
  • 打赏
  • 举报
回复
楼主你的给的那个网站点击链接后url变了,就是页面刷新了,在具体的页面哪里直接把当前项的链接设置成加粗的。。如果是同一个页面需要根据参数来设置。
yinschao1 2010-01-22
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 ck11926375 的回复:]
移动 点击后连接文字变大:
CSS codea:hover{color: red; text-decoration:underline; font-size:18px;}
a:visited{color:purple;text-decoration:none; font-size:18px;}

点其他连接文字回复过来,用JS来控制!
[/Quote]
嗯 但是js如何控制?能帮忙解决吗?谢谢!
ck11926375 2010-01-22
  • 打赏
  • 举报
回复
移动 点击后连接文字变大:
a:hover {color: red; text-decoration:underline; font-size:18px;}  
a:visited {color:purple;text-decoration:none; font-size:18px;}


点其他连接文字回复过来,用JS来控制!
qq373591361 2010-01-22
  • 打赏
  • 举报
回复
如果单要效果的话,可以在事件下用css控制
浴火_凤凰 2010-01-22
  • 打赏
  • 举报
回复
循环啊!!!先设置都不变粗,单击其中一个后变粗,等单击其它的时候全部设置不变粗,在单独设置单击的链接变粗
xmliy 2010-01-22
  • 打赏
  • 举报
回复

<A href="test1.htm" target="_blank">WebSiteA</A>
<A href="test2.htm" target="_blank">WebSiteB</A>



var links = document.getElementsByTagName('a'), selectedLink = null;
for (var i = 0, length = links.length; i < length; i++) {
links[i].onmouseover = function() {
this.style.fontWeight = 'bold';
}
links[i].onmouseout = function() {
if(this != selectedLink) this.style.fontWeight = '';
}
links[i].onclick = function() {
if (selectedLink) selectedLink.style.fontWeight = '';
selectedLink = this;
}
}
yinschao1 2010-01-22
  • 打赏
  • 举报
回复
这个是test1.html的代码
<table width="180" border="0" cellspacing="0" cellpadding="0">
<tr>
<Td height="18">
<FONT color=#ff3300><B>  -</B></FONT><A href="test1.htm">WebSiteA</A>
</tr>
<tr>
<Td height="18">
<FONT color=#ff3300><B>  -</B></FONT><A href="test2.htm">WebSiteB</A></tr>
</table>
您点击的是websiteA,我想用js来实现效果如http://www.4world.pl/categories/kategoria/29这个网站的产品列表,当鼠标放上去,文字链接变大,点击后,文字链接还是变大,当点击其他的文字连接后,原来点击过的文字链接恢复原形,新点击的文字链接就变粗了。谢谢


这个是test2.html的代码
<LINK href="t/Style.css" type=text/css rel=stylesheet>
<table width="180" border="0" cellspacing="0" cellpadding="0">
<tr>
<Td height="18">
<FONT color=#ff3300><B>  -</B></FONT><A href="test1.htm">WebSiteA</A>
</tr>
<tr>
<Td height="18">
<FONT color=#ff3300><B>  -</B></FONT><A href="test2.htm">WebSiteB</A></tr>
</table>
您点击的是websiteB,我想用js来实现效果如http://www.4world.pl/categories/kategoria/29这个网站的产品列表,当鼠标放上去,文字链接变大,点击后,文字链接还是变大,当点击其他的文字连接后,原来点击过的文字链接恢复原形,新点击的文字链接就变粗了。谢谢
yinschao1 2010-01-22
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 msdnlu 的回复:]
onclick=fucntion(this){
document.getElementsByTagName('input')[0].style.fontWeight='normal';
document.getElementsByTagName('input')[1].style.fontWeight='normal';
document.getElementsByTagName('input')[2].style.fontWeight='normal';
this.style.fontWeight='bold'; }
[/Quote] 具体如何实现?谢谢!

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧