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 to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    styleSelected script

    Hi there,

    built a sliding gallery with a tab control at the top. I have a script which appears to work in Firefox but not IE. THe issus is the tabs are sticking to the right divs when you leave the page and then come back to it.

    Any suggestions would be welcome

    <%
    'Dim registerScript
    'registerScript ="onload=""changeStyle(document.getElementById('styleSelected').value);"""
    %>

    <!--#include virtual="/includes/navigation-includes/top-template.asp" -->
    <!--#include file="page-name.asp" --><!-- to add a page name to all hub pages so that the page id in the side_nav_container.asp links to the page specified within the page-name.asp -->
    <script src="/includes/javascript-includes/prototype.js" type="text/javascript" charset="utf-8"></script>
    <script src="/includes/javascript-includes/effects.js" type="text/javascript" charset="utf-8"></script>
    <script src="/includes/javascript-includes/slider.js" type="text/javascript" charset="utf-8"></script>

    <div class="controls" id="gourmet">
    <ul id="nav">
    <li id="t-gourmet"><a href="#section1" onclick="changeStyle('gourmet');" id="gourmet-link">gourmet delight</a></li>
    <li id="t-pamper"><a href="#section2" onclick="changeStyle('pamper');" id="pamper-link">pamper yourself</a></li>
    <li id="t-modern"><a href="#section3" onclick="changeStyle('modern');" id="modern-link">modern chic</a></li>
    <li id="t-grand"><a href="#section4" onclick="changeStyle('grand');" id="grand-link">grand opulence</a></li>
    <li class="end" id="t-special"><a href="#section5" onclick="changeStyle('special');" id="special-link">special offers</a></li>
    </ul>
    <div class="scroller">
    <div class="content">

    <script type="text/javascript">
    function changeStyle(obj) {
    //alert(obj);
    if(obj.length>0)
    {
    var links = document.getElementsByTagName("div")
    for(i=0;i<links.length;i++) {
    if (links[i].className=='controls')
    {links[i].id=(obj);}
    }
    document.getElementById("styleSelected").value = obj;
    //alert(document.getElementById("styleSelected").value);
    }

    } //end func
    </script>
    <input type="hidden" id="styleSelected" value=""></input>

  • #2
    New Coder
    Join Date
    Apr 2007
    Location
    Silicon Valley California
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can you link to an example? Also, which version of IE 6 or 7 or both?

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    http://www.hotelconnect.co.uk/hubs/l...uxury-home.asp

    This is not advertising before anyone says anything!

  • #4
    New Coder
    Join Date
    Apr 2007
    Location
    Silicon Valley California
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I get an exception in IE at this line

    document.getElementById('t-'+active).style.backgroundColor=(active=='special')?'#C1111E': '#AA87B5';

    my guess is this has something to do with why the tabs aren't working. I don't have a good IE debugger on this computer, so you'll have to manually test the variables.


  •  

    Posting Permissions

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