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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could someone help with this?

Status
Not open for further replies.

dalec

Programmer
Jul 8, 2000
191
0
0
US
I copied the bulk of this from the MS website, I've been looking for a menu interface for my site. I've modified this enough that it doesnt display the list expanded, but, then when you click on an item, it doesnt expand back out.

I program in VB, but this script is driving me crazy. Some of the menu item have been unchanged since I copied it.

Thanks (very much) in advance,
Dale



<HEAD>
<SCRIPT>
function init()
{
var coll = document.all.tags(&quot;LI&quot;);
if (coll != null)
{
for (i=0; i < coll.length; i++)
if (coll.className == &quot;COLLAPSING&quot;)
{
coll.style.listStyleImage = &quot;url(' coll.style.display='';
}
else if (coll.className == &quot;SINGLE&quot;)
{
coll.style.listStyleImage = &quot;url(' coll.style.display='';
}
else
{
coll.style.listStyleImage = &quot;url(' coll.style.display = 'none';
}
}
}


function expandCollapse ()
{
oSource = event.srcElement;
if (oSource.className != &quot;COLLAPSING&quot;)
{
event.srcElement.style.listStyleImage = &quot;url(' event.srcElement.style.display='';
return;
}
else
{
event.srcElement.style.listStyleImage = &quot;url(' event.srcElement.style.display='';
}
oChild = document.all(oSource.getAttribute('CHILD', false));
if (oChild.style.display=='none')
{
oChild.style.display='';
event.srcElement.style.listStyleImage='url( }
else
{
oChild.style.display='none';
event.srcElement.style.listStyleImage='url( }
}

function doMouseOver()
{
oSource = event.srcElement;
if ((oSource.className != &quot;COLLAPSING&quot;) && (oSource.tagName != &quot;A&quot;))
return;

oSource.style.cursor = &quot;hand&quot;;
oSource.style.color = &quot;red&quot;;
}

function doMouseOut()
{
oSource = event.srcElement;
if ((oSource.className != &quot;COLLAPSING&quot;) && (oSource.tagName != &quot;A&quot;))
return;

oSource.style.cursor = &quot;&quot;;
oSource.style.color = &quot;black&quot;;
}
</SCRIPT>
</HEAD>

<BODY BGCOLOR=&quot;#FFFFFF&quot;
onload=&quot;init()&quot;
onmouseover=&quot;doMouseOver()&quot;
onmouseout=&quot;doMouseOut()&quot;
onclick=&quot;expandCollapse()&quot; >


<FONT SIZE=1 FACE=&quot;Verdana,Arial,Helvetica&quot;>
<UL>
<LI CLASS=&quot;COLLAPSING&quot; CHILD=&quot;Topics1&quot;>HTML Authoring</LI>
<UL ID=&quot;Topics1&quot;>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>Beginner's Guide</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>IE4.0 Authoring Tips</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>HTML Coding Tips</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>Table Cell Backgrounds</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>Drop Caps</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>Quote Server</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>HTML Wizard</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>Dr. HTML</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>HTML Coding FAQ for Internet Explorer</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>SGML DTD for Internet Explorer 3.0 Markup</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>Authoring Basics</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>Authoring Effective Pages</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>Designing Efficient Pages</A></LI>
<LI><A HREF=&quot;/workshop/author/default.asp&quot;>Using Frames</A></LI>
</UL>
<LI CLASS=&quot;SINGLE&quot;><A HREF=&quot;/workshop/author/default.asp&quot;>HTML Help Authoring</A></LI>
<LI CLASS=&quot;COLLAPSING&quot; CHILD=&quot;Topics2&quot;>HTML References</LI>
<UL ID=&quot;Topics2&quot;>
<LI><A HREF=&quot;/workshop/author/default.htm&quot;>Elements</A></LI>
<LI><A HREF=&quot;/workshop/author/default.htm&quot;>Character Sets</A></LI>
</UL>
<LI CLASS=&quot;COLLAPSING&quot; CHILD=&quot;Topics3&quot;>HTML Applications (HTA)</LI>
<UL ID=&quot;Topics3&quot;>
<LI><A HREF=&quot;/workshop/author/default.htm&quot;>Overview</A></LI>
<LI><A HREF=&quot;/workshop/author/default.htm&quot;>Reference</A></LI>
</UL>
</UL>
</FONT>
</BODY>
 
Hi there,
whats the problem, it wont expand back out??

When I load the script it is fully expand. I can collapse the tree and I can also expand it again, no problems.

The only error I get is

Line: 20
Error: 'style' is null or not an object

...but I didnt check the code to see if posting it on TT added any extra ; like it sometimes does!

I have another version of this type of script if you want it. It does the same thing basically but its JS not VB.



É

endamcg-logo1b.gif

 
Thank you for your help, I also left my message in the Javascript forum, and someone was also kind enough to reply, with some tips on why it was doing wrong for me.

Thank you, I included the link below if you or any one else is interested, thanks again!!


<a href=&quot;thread216-305887
 
Nice Script!
Well nothing goes wrong with me.
It's perfect.... Momin ho to bay taigh bhee lerta hay sipahee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top