如何在iframe中打开链接时更改菜单链接颜色?

时间:2015-09-22 07:14:11

标签: html css3

<html>
<body>
<div id="navi">
<ul width="100%" align="center" style="padding-top:20px; display:inline">
<li>    
<a style="font-size:25px; color:#0ff; padding-top:20px;    font-weight:bold;" href="corporate_frame.html" target="load">Corporate</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</li>   
<li>    
<a style="font-size:25px; color:#0ff; font-weight:bold"  href="security_frame.html" target="load">Security</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</li>   
<li>
<a style="font-size:25px; color:#0ff; font-weight:bold" href="driver_frame.html" target="load">Driver</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</li>   
<li>
<a style="font-size:25px; color:#0ff; font-weight:bold" href="medical_frame.html" target="load">Medical</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</li>
<li>
<a style="font-size:25px; color:#0ff; font-weight:bold" href="engineering_frame.html" target="load">Engineering</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</li>
<li>
<a style="font-size:25px; color:#0ff; font-weight:bold" href="hospitality_frame.html" target="load">Hospitality</a>
</li>
</ul>//closing tag of un order list
<br>
<br>

<iframe src="corporate_frame.html" style="height:250px; width:1310px; border:none;" name="load"></iframe>


</div>
</body>
</html>

请告诉我,点击“公司”或任何其他链接时,应该更改该链接的颜色,直到打开另一个链接。

2 个答案:

答案 0 :(得分:0)

我不确定这会有效,但我认为它会:

.menulink
{ 
  color: #0000FF;
  cursor: pointer;
}

.menulink:hover
{ 
  color: #FF0000;
  cursor: pointer;
}

See the link

答案 1 :(得分:0)

您对如何实现此目标没有太多见解,但下面是一个jQuery解决方案。我也猜测你只是试图展示出活跃的&#34;菜单上的链接?

$("div#navi a").each(function ()
 {
        $(this).bind("click", function ()
        {
            // Reset other link colors to "#0ff"
            $("div#navi a").css("color", "#0ff");

            // Change color for this link to "blue"
            $(this).css("color", "blue");
        });
});