Forum Moderators: open

Message Too Old, No Replies

IE6/7 breaks JS on #navList li a:hover

         

martal

2:26 pm on Nov 23, 2008 (gmt 0)

10+ Year Member



I have a little sidebar div to display guest testimonials.

Only two displayed out of fifteen (eventually) using this code:

function randomorder(targetarray, spacing)
{
var randomorder=new Array()
var the_one
var z=0
for (i=0;i<targetarray.length;i++)
randomorder[i]=i

//while (z<targetarray.length){
while (z<2){
the_one=Math.floor(Math.random()*targetarray.length)
if (targetarray[the_one]!="_selected!"){
document.write(targetarray[the_one]+spacing)
targetarray[the_one]="_selected!"
z++
}
}
}

var content=new Array()
content[0]='<p>"The best B &amp; B we&#8216;ve stayed in!"<p><span>John &amp; Maggie, Australia</span></p>'
content[1]='<p>"Wonderful stay, great breakfast"<p><span>Helen &amp; David, Exeter</span></p>'
content[2]='<p>"View to die for"<p><span>Joe &amp; Jane, Barcelona</span></p>'

called from:
<div id="sidebarTestimonials">
<h3>Testimonials</h3>
<script type="text/javascript">randomorder(content, '')</script>
</div>

(The span is there for trying to fix the IE problem, I thought it was the double quotes for a p class.)
Works fine in Firefox.

I also have CSS:

#navList li a:hover,
#navList li a:active ,
body#home a#homeNav,
body#details a#detailsNav,
body#rooms a#roomsNav,
body#availability a#availabilityNav,
body#contact a#contactNav {
background: url(/images/bg_navHover.jpg);
color: inherit;
}

Comment out the above, IE6 and 7 display the two testimonials correctly.

But when active, only the final paragraph is displayed when I hover over a nav item, although sometimes it works.

What might be going on here?

RonPK

9:28 pm on Nov 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



content[x]='<p>text<p><span>text</span></p>'

What happens when you fix the broken HTML?

martal

5:18 pm on Nov 25, 2008 (gmt 0)

10+ Year Member



hmm . . . well, it works!

So dumb :(

Will not say any more, Ron, apart from thanks for pointing my basic error.

RonPK

12:59 pm on Nov 26, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



He he, you're welcome :)