View Full Version : styleSelected script

06-07-2007, 02:21 PM
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>
<div class="scroller">
<div class="content">

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

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

06-07-2007, 07:39 PM
Can you link to an example? Also, which version of IE 6 or 7 or both?

06-08-2007, 10:22 AM

This is not advertising before anyone says anything!

06-14-2007, 03:53 AM
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.