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 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2008
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Adding Breadcrumbs to Coda Slider

    Hello there,
    I am working on a Coda Slider Effect but i'm having one issue with trying to implement a breadcrumb outside of the slider div.

    Is there a way to use window.location.hash to display a different breadcrumb location. eg Home > About Us or Home > Services.

    I understand PHP statement but just can't transfer the logic to Javascript, here is an example of what I'm trying to do but I understand echo doesn't work in Javascript
    Code:
    var page = location.hash;
    switch(page)
    {
    case "#home":
    echo '<li>Home</li>';
    break;    
    case "#about":
    echo '<li>Home</li><li>About<li>/';
    break;
    case "#contact":
    echo '<li>Home</li><li>Contact<li>/';
    break;
    default:
    echo '<li>Home</li>';
    }
    Any help would be great. Thanks in advance, Ryan

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,734
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Try searching this forum for breadcrumbs.

  • #3
    New Coder
    Join Date
    Sep 2008
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hey Philip,
    I tried searching but everything was for PHP.
    I had another go but still no luck.
    Code:
    <script type="text/javascript">
            	var page = location.hash;
                switch(page){
                case "#home":
                pageurl = '<li>Home</li>';
                break;    
                case "#about_us":
                pageurl = '<li><a href="#home">Home</a> /</li><li>About Us</li>';
                break;
    			case "#our_brands":
                pageurl = '<li><a href="#home">Home</a> /</li><li>Our Brands</li>';
                break;
    			case "#international":
                pageurl = '<li><a href="#home">Home</a> /</li><li>International</li>';
                break;
    			case "#our_news":
                pageurl = '<li><a href="#home">Home</a> /</li><li>Our News</li>';
                break;
                case "#get_in_touch":
                pageurl = '<li><a href="#home">Home</a> /</li><li>Get in Touch</li>';
                break;
                default:
                pageurl = '<li>Home</li>';}
    			document.write(pageurl);
    			</script>
    Regards

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,734
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    JavaScript cannot actively read variables from the server, but when a page loads, PHP can pass variables to JavaScript by writing to the page the JavaScript is on.


    PHP Code:
    <script type="text/javascript">
    <!--
    <?php 
    echo("firstVar = $var1;");
    echo(
    "secondVar = $var2;");
    ?>
    // -->
    </script>


  •  

    Posting Permissions

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