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

  • Home
  • SEARCH
  • 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 6155807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:30:05+00:00 2026-05-23T20:30:05+00:00

Let me ask this a different way: based on the url I want to

  • 0

Let me ask this a different way: based on the url I want to update an image that is used in my main menu.

I am trying to do the following (my JavaScript is crap)

urlPath = document.location.href;

<td>

 <script type="text/javascript">


if (urlPath=="mydomain.com/home/")
  {
  document.write("<img src='current_page.jpg'/>");
  }else{
document.write("<img src='image/normal_button.jpg'/>");
}
</script>
</td>

and then I could do that for every menu item. Would that work or is there a better way of doing it?

Below is my current code that I will have to update eventually.

<body onload="MM_preloadImages('/storage/images/nav_products_over.png','/storage/images/nav_about_over.png','/storage/images/nav_school_over.png','/storage/images/nav_blog_over.png','/storage/images/nav_wholesale_over.png','/storage/images/nav_gifts_over.png','/storage/images/nav_catering_over.png','/storage/images/nav_menus_over.png','/storage/images/nav_press_over.png','/storage/images/nav_contact_over.png')">
<table width="800" border="0" align="center">
  <tr>
    <td width="36%"><a href="/"><img src="/storage/images/logo.png" alt="" width="206" height="113" /></a></td>
    <td width="64%"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><a href="/products/" target="_top" onclick="MM_nbGroup('down','group1','Products','/storage/images/nav_products_over.png',1)" onmouseover="MM_nbGroup('over','Products','/storage/images/nav_products_over.png','',1)" onmouseout="MM_nbGroup('out')"><img src="/storage/images/nav_products.png" alt="" name="Products" border="0" id="Products2" onload="" /></a></td>
        <td><a href="/about/" target="_top" onclick="MM_nbGroup('down','group1','About','',1)" onmouseover="MM_nbGroup('over','About','/storage/images/nav_about_over.png','',1)" onmouseout="MM_nbGroup('out')"><img src="/storage/images/nav_about.png" alt="" name="About" width="72" height="26" border="0" id="About2" onload="" /></a></td>
        <td><a href="/school-of-fish/" target="_top" onclick="MM_nbGroup('down','group1','School','',1)" onmouseover="MM_nbGroup('over','School','/storage/images/nav_school_over.png','',1)" onmouseout="MM_nbGroup('out')"><img src="/storage/images/nav_school.png" alt="" name="School" width="155" height="26" border="0" id="School2" onload="" /></a></td>
        <td><a href="/blog/" target="_top" onclick="MM_nbGroup('down','group1','Blog','',1)" onmouseover="MM_nbGroup('over','Blog','/storage/images/nav_blog_over.png','',1)" onmouseout="MM_nbGroup('out')"><img src="/storage/images/nav_blog.png" alt="" name="Blog" width="55" height="25" border="0" id="Blog2" onload="" /></a></td>
      </tr>
    </table>
      <table width="100%" border="0">
        <tr>
          <td width="19%" height="30" valign="bottom"><a href="/wholesale/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('wholesale','','/storage/images/nav_wholesale_over.png',1)"><img src="/storage/images/nav_wholesale.png" alt="" name="wholesale" width="67" height="14" border="0" id="wholesale" /></a></td>
          <td width="13%" height="30" valign="bottom"><a href="http://ws2519-2640.staging.nitrosell.com/store/product/1707/Gift-Card-%2450/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Gifts','','/storage/images/nav_gifts_over.png',1)"><img src="/storage/images/nav_gifts.png" alt="" name="Gifts" width="34" height="14" border="0" id="Gifts" /></a></td>
          <td width="17%" height="30" valign="bottom"><a href="/catering/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('catering','','/storage/images/nav_catering_over.png',1)"><img src="/storage/images/nav_catering.png" alt="" name="catering" width="55" height="14" border="0" id="catering" /></a></td>
          <td width="12%" height="30" valign="bottom"><a href="/menus/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('menus','','/storage/images/nav_menus_over.png',1)"><img src="/storage/images/nav_menus.png" alt="" name="menus" width="39" height="14" border="0" id="menus" /></a></td>
          <td width="22%" height="30" valign="bottom"><a href="/press/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('press','','/storage/images/nav_press_over.png',1)"><img src="/storage/images/nav_press.png" alt="" name="press" width="73" height="14" border="0" id="press" /></a></td>
          <td width="17%" height="30" valign="bottom"><a href="/contact-us/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact','','/storage/images/nav_contact_over.png',1)"><img src="/storage/images/nav_contact.png" alt="" name="contact" width="51" height="14" border="0" id="contact" /></a></td>
        </tr>
      </table></td>
  </tr>
</table>
  • 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-05-23T20:30:05+00:00Added an answer on May 23, 2026 at 8:30 pm

    Just so everyone can see how I accomplished my function using jQuery

     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script type="text/javascript">
        $(document).ready(function(){
    
            var url = window.location.pathname;
            //if the variables below find a match they return a -1
            var tempProducts = url.search(/products/g);
            var tempAbout = url.search(/about/g);
            var tempSchool = url.search(/school-of-fish/g);
            var tempBlog = url.search(/blog/g);
    
            if (tempProducts == "1"){//you might have to take the quotes off of the -1 I don't know for sure
                //$('#Products2').unbind('onmouseover').unbind('onmouseout');
                $('#Products2').attr("src","/storage/images/nav_products_over.png");
            }
            if (tempAbout == "1"){
                //$('#About2').unbind('onmouseover').unbind('onmouseout');
                $('#About2').attr("src","/storage/images/nav_about_over.png");
            }
            if (tempSchool == "1"){
                //$('#School2').unbind('onmouseover').unbind('onmouseout');
                $('#School2').attr("src","/storage/images/nav_school_over.png");
            }
            if (tempBlog == "1"){
                //$('#Blog2').unbind('onmouseover').unbind('onmouseout');
                $('#Blog2').attr("src","/storage/images/nav_blog_over.png");
            }
    
                                   });
        </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me try to ask this question from a different angle. I noticed that
Let's say that you are limited to use only this syntax (you can't use
First, let me ask you to consider this as a real question, and not
I need a way to layout controls in a page. Let me ask you
This is my .htaccess It feels like its way to long and that it
Scenario: I have several services that I want to be discovered by different clients.
This question is quite hypothetical but I'll ask anyway. Let's say you start a
I asked a related question about findbugs, but let's ask a more general question.
Let me try to explain what I need. I have a server that is
Let's say I have a drive such as C:\ , and I want to

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.