Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jan 2013
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Changing a button url on my home page nav menu...

    I have a url that I have labeled as HOME on my nav menu that is delivered dynamically. The problem is, I can't change this url. I need to be able to change it in dom so when it is clicked, it becomes a link that just redirects to my home page.

    You can see what I'm talking about at www.mixnob.com. The very first button on my top nav bar is labeled "HOME". But the link that is assigned to it doesn't work since it is dynamically created by the ecommerce software I'm using and cannot be changed. So if I could change it using a script, I think it would work just fine.

    Any help with what that code would be would be very appreciated.

    Thanks,
    Brook Floyd

  • #2
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Try this, positioned at the bottom of the body section:
    Code:
    <script type="text/javascript">
    
    document.getElementById( "HeaderLower" ).getElementsByTagName( 'A' )[ 0 ].href = "myHomePageURL";
    
    </script>
    Where "myHomePageURL" is the URL you want to use.

  • #3
    New Coder
    Join Date
    Jan 2013
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hello and thanks for that code. It worked perfectly on the home page but doesn't work anywhere else on the site once you follow links past the home page.

    Is there any way to get it to work site-wide other than having to paste it into hundreds of html pages that represent the rest of the site? That's the only way I can think of making it work.

    Thanks,
    Brook Floyd

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    If there is a document that is run with every page load (ie, in ColdFusion, application.cfm or application.cfc is run before any other processing, on every page load) you can place the script, there. Perhaps a header or footer?
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,596
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    If you take your site out of maintenance so we could see some of the other pages, you might get help from others.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    New Coder
    Join Date
    Jan 2013
    Posts
    19
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks again for the help and sorry I had the site down. I did end up finding a header file that seems to be pretty universal throughout the site. It seems to work on just about everything now. I have to do a little more testing but so far so good.

    Also, I was wondering if anyone here does any freelance work for hire? I need just a couple things done in the site that I don't have the knowledge to do. Mostly with JavaScript and Ajax. And a couple very small issues with some CSS. Not much overall work. Probably an hour or two for an experienced coder.

    Thanks,
    Brook Floyd

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,596
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    There's a special section on this site where you can hire freelancers.
    http://www.codingforums.com/web-projects/
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •