Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7749849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:08:24+00:00 2026-06-01T11:08:24+00:00

I’m making a very basic menu for my site and I have used the

  • 0

I’m making a very basic menu for my site and I have used the border-bottom property to underline the items. What I want is to highlight the underline pink if you’re on a certain page. I’ve used custom “url” elements and “link” attributes. I would like it so if the user is on page1 the page1 item would underline pink. Here’s what I’ve tried so far:

<script>
function col(){if(top.location.href==document.getElementsByTagName("url")[1].link){this.style.borderBottom="solid #F05";};}
</script>

^ That was completely wrong, I was testing with a bit of code from W3Schools.
I also tried:

<script>
function menuCol(url){if(top.location == url){this.style.borderBottom="solid #F05";};}
</script>

^ This one worked but I had to include “[PAGE NO]” on every page so the script could match the IDs of the page and URL element.

Does anyone know how I can actually make this work without having to put in pageID tags in?

—– Edit —–
Sorry, I’m not exactly sure how to put the problem into words but here’s the page and source code (currently):

http://3659905.webs.com/ExternalPages/Desktop/Menubar_test.htm

<head>
<title>Menu</title>

<noframes></noframes><noscript></noscript><!-- --><script type="text/javascript" src="http://www.freewebs.com/p.js"></script><script></script>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script language="JavaScript" src="http://images.freewebs.com/JS/Freebar/bar_sidegrey.js"></script>

<script>
$(document).ready(function(){
$("url").click(function(){
top.location.href="http://"+$(this).attr("link")
});
});
</script>

<script>
function col(){if(top.location.href==document.getElementsByTagName("url")[1].link){this.style.borderBottom="solid #F05";};}
</script>

<style>
url{text-decoration:none;font-size:15px;padding:3px;border-bottom:solid #AAA;}
url:hover{cursor:pointer;border-bottom:solid #FFF}

body{background:black;color:white;font-family:arial;cursor:default;}
</style>
</head>



<body onselectstart="return false;" oncontextmenu="return false;" onload="col();">
<center>

<url link="3s.uk.to">Home</url>
<url link="3apps.uk.to">App Store</url>
<url link="3659905.webs.com/ExternalPages/Desktop/Menubar_test.htm">Menu Test</url>

</center>
</body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:08:25+00:00Added an answer on June 1, 2026 at 11:08 am

    The best guess I could make, given the sparsity of information in the question, is this:

    // in real life, use:
    // var url = window.location;
    var url = "http://some.domain.com/index.html";
    
    function markActive(elem) {
        if (url.indexOf(elem.href.split('/').pop()) > -1) {
            return 'active'
        }
    }
    
    var as = document.getElementsByTagName('a');
    for (var i=0,len=as.length; i<len; i++){
        as[i].className = markActive(as[i]);
    }​
    

    JS Fiddle demo.

    This, in its current incarnation, works only for the name of the page, so if you had multiple index.html pages, albeit in different directories, they would all assign the active class (if you were currently in www.example.com/index.html).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.