Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TOC Script IE 7

Status
Not open for further replies.
Sep 7, 2009
29
US
Hello I have a TOC script that works in Firefox but not in IE 7. Can someone help me? Here is my code:


Code:
Javascript
script.js

$(document).ready(function() {
$("#toc")
$("H5").each(function(i) {
var current = $(this);
 current.attr("id", "title" + i);
$("#toc").append("<a id='link" + i + "' href='#title" + i + "' title='" + 

current.attr("tagName") + "'>" + current.html() + "</a>");
 });


Css

* {
margin:0;
padding:0;
}

body {

font-family:Verdana,Times New Roman,Arial,Helvetica,georgia, serif;
color:#000;
width:550px;
}


li{


	padding:0;
	list-style-position: inside;
	font-size:14px;
	font-family:Verdana,Times New Roman,Arial,Helvetica,georgia, serif;
}


p{
	font-family:Verdana,Times New Roman,Arial,Helvetica,georgia, serif;
	font-size:14px;
	margin:0;
}

#header {
height: 97px;
width: 550px;
border-left:1px solid #2e6e9e;
border-right:1px solid #2e6e9e;
border-top:1px solid #2e6e9e;
border-bottom:1px solid #2e6e9e;
}


#headerleft{
background-color:#0c0c9f;
color:#fff;
width:437px;
height:97px;
float:right;

}


#container{
overflow:hidden;
word-wrap: break-word;
width:550px;
border-left:1px solid #2e6e9e;
border-right:1px solid #2e6e9e;
border-bottom:1px solid #2e6e9e;
}

#toc {
	display:block;
	width:550px;
	height:16px;
	border:1px solid #2e6e9e;
	background-color:#c5dbec;
	padding: 5px 0px;
	margin:0 0 0px;
}



#accordion{
margin:0 0 27px;	
zoom: 1;
}
	


h1{
font-family:Verdana,Times New Roman,Arial,Helvetica,georgia, serif;
font-size: 24px;
text-align:center;
color:#fff;
line-height:4;
margin:0;
padding:0;

}


h2{
	font-family:Verdana,Times New Roman,Arial,Helvetica,georgia, serif;
	font-size: 36px;
	color:#0c0c9f;
	margin:0;
}


h3 {
	font-size: 24px;
}

h4{
font-family:Verdana,Times New Roman,Arial,Helvetica,georgia, serif;
font-size: 18px;
color:#000;
}



h5{
font-family:Verdana,Times New Roman,Arial,Helvetica,georgia, serif;
text-align:left;
color:#0c0c9f;
font-size: 36px;

}


Html
<div id ="toc">
   <a id="link0" title="H5" href="#title0">A</a>
   <a id="link1" title="H5" href="#title1">B</a>
    </div>
      
    
<div id ="container">
<div id="accordion">
 
<H5 id="title0">A</H5>


<h3><a href="#">Title</a></h3>

<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus nec consequat 

eros. Integer scelerisque risus vel lacus viverra sit amet fermentum nunc 

dapibus. Cras ut nisl ante. Nunc auctor pretium pharetra. In feugiat, diam vel 

pharetra tempor, leo massa porttitor purus, sit amet luctus risus metus non dui. 

Curabitur placerat, ipsum id venenatis ullamcorper, turpis turpis dignissim 

diam, quis sodales magna lacus eu tellus. Nulla vitae magna orci, quis porttitor 

magna. Morbi aliquam, risus id facilisis posuere, augue sem commodo
</p>
</div>

<H5 id="title1">B</h5>

<h3><a href="#">Title</a></h3>
<div>
<p>

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus nec consequat 

eros. Integer scelerisque risus vel lacus viverra sit amet fermentum nunc 

dapibus. Cras ut nisl ante. Nunc auctor pretium pharetra. In feugiat, diam vel 

pharetra tempor, leo massa porttitor purus, sit amet luctus risus metus non dui. 

Curabitur placerat, ipsum id venenatis ullamcorper, turpis turpis dignissim 

diam, quis sodales magna lacus eu tellus. Nulla vitae magna orci, quis porttitor 

magna. Morbi aliquam, risus id facilisis posuere, augue sem commodo

</p>

   </div>
   

 
</div>
 </div>
 
It seems you miss another set of closing curly and parenthsis combination at the end of script.js. (If there isn't, there is no reason ff works neither. So, don't know.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top