Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-22-2013, 02:08 AM   PM User | #1
brookfloyd
New Coder

 
Join Date: Jan 2013
Posts: 19
Thanks: 1
Thanked 0 Times in 0 Posts
brookfloyd is an unknown quantity at this point
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
brookfloyd is offline   Reply With Quote
Old 01-22-2013, 06:04 AM   PM User | #2
Logic Ali
Regular Coder

 
Logic Ali's Avatar
 
Join Date: Sep 2010
Location: London
Posts: 959
Thanks: 0
Thanked 198 Times in 193 Posts
Logic Ali will become famous soon enoughLogic Ali will become famous soon enough
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.
Logic Ali is offline   Reply With Quote
Old 01-23-2013, 07:29 AM   PM User | #3
brookfloyd
New Coder

 
Join Date: Jan 2013
Posts: 19
Thanks: 1
Thanked 0 Times in 0 Posts
brookfloyd is an unknown quantity at this point
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
brookfloyd is offline   Reply With Quote
Old 01-23-2013, 01:48 PM   PM User | #4
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 946
Thanks: 7
Thanked 97 Times in 97 Posts
WolfShade is an unknown quantity at this point
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".
WolfShade is offline   Reply With Quote
Old 01-24-2013, 02:33 AM   PM User | #5
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,195
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
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.
Old Pedant is offline   Reply With Quote
Old 01-24-2013, 07:28 AM   PM User | #6
brookfloyd
New Coder

 
Join Date: Jan 2013
Posts: 19
Thanks: 1
Thanked 0 Times in 0 Posts
brookfloyd is an unknown quantity at this point
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
brookfloyd is offline   Reply With Quote
Old 01-24-2013, 07:37 AM   PM User | #7
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,195
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
There's a special section on this site where you can hire freelancers.
http://www.codingforums.com/forumdisplay.php?f=47
__________________
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.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:48 PM.


Advertisement
Log in to turn off these ads.