0

我有带有标题 DIV 的“主页”和两个左右分开的 iframe。左侧我加载了菜单树视图页面。标题 div 包含一些锚标记,其中包含一些用 Jquery 编写的样式和样式。当用户单击锚标记时,它将突出显示。当用户单击左侧框架(菜单)时,如果锚标记在标题 div 中突出显示,那么我必须删除突出显示的样式。谁能告诉我该怎么做?

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Home Page</title>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <link rel="stylesheet" href="Css/HomePageStyle.css" type="text/css" />

    <!-- Import JQuery Plugins -->
    <script type="text/jscript" src="jquery/jquery-1.9.1.js"></script>
    <script type="text/jscript" src="jquery/jquery-ui-1.10.3.js"></script>
    <link rel="stylesheet" href="jquery/jquery-ui.css" type="text/css" />

    <script type="text/javascript" src="JavaScript/DisableBackSpace.js"></script>
    <script type="text/javascript" src="JavaScript/DisableMouseRightClick.js"></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $('#lnkHomePage').click(function () {
                $('#lnkHomePage').css('background-color', '#498120');
                $('#lnkHomePage').css('color', '#fff');

                $('#lnkMyProf').css('background-color', '#fff');
                $('#lnkMyProf').css('color', '#556B2F');

                $('#lnkChgPwd').css('background-color', '#fff');
                $('#lnkChgPwd').css('color', '#556B2F');
            });

            $('#lnkMyProf').click(function () {
                $('#lnkMyProf').css('background-color', '#498120');
                $('#lnkMyProf').css('color', '#fff');

                $('#lnkChgPwd').css('background-color', '#fff');
                $('#lnkChgPwd').css('color', '#556B2F');

                $('#lnkHomePage').css('background-color', '#fff');
                $('#lnkHomePage').css('color', '#556B2F');
            });

            $('#lnkChgPwd').click(function () {
                $('#lnkChgPwd').css('background-color', '#498120');
                $('#lnkChgPwd').css('color', '#fff');

                $('#lnkHomePage').css('background-color', '#fff');
                $('#lnkHomePage').css('color', '#556B2F');

                $('#lnkMyProf').css('background-color', '#fff');
                $('#lnkMyProf').css('color', '#556B2F');
            });

        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="header">
        <div class="lefttext">
            Welcome
        </div>
        <div class="righttext">
            <div>
                <label id="lblLoginUserName" runat="server"></label> <p>|</p>
            </div>
            <div>
                <a id="lnkHomePage" href="welcomepage.aspx" target="mainFrame">Home</a> <p>|</p>
            </div>
            <div>
                <a id="lnkMyProf" href="myprofile.aspx" target="mainFrame">My profile</a> <p>|</p>
            </div>
            <div>
                <a id="lnkChgPwd" href="ChangePassword.aspx" target="mainFrame">Change password</a> <p>|</p>
            </div>
            <div>
                <a href="">Logout</a>
            </div>
        </div>
    </div>
    <table cellspacing="0" id="main">
        <tr>
            <td class="leftnav">
                <div class="leftnavheader">
                    Menu</div>
                <div class="menu">
                    <iframe src="MenuItem.aspx" frameborder="0" style="height: 94.5%; width: 100%;" name="menuFrame">
                    </iframe>
                </div>
            </td>
            <td class="content">
                <div class="MainFrame" id="MainDiv" runat="server">
                    <iframe src="WelcomePage.aspx" id="maincontentpageframe" style="width: 100%; height: 99.2%;"
                        frameborder="1" name="mainFrame" runat="server"></iframe>
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>*
4

0 回答 0