![]() |
|
![]() |
![]() | Customer: Sign in Delegate: Sign in Trainer: Log in |
|
Forum home » Delegate support and help forum » Dreamweaver Training and help » dreamweaver course london - Layers dreamweaver course london - LayersThe UK's most regular instructor-led training courses.
Layers
Karen has attended:
have created a menu on the left hand side of my page and I want to create dropdown options which appear under them either when you click on the main heading or when you hover over it with your mouse. How do I do this as at the moment I can only create ones that are there all the time.
RE: Layers
Karen, First, save this into a javascript file (eg. global.js)var supported = (document.getElementById || document.all); if (supported) { // set all to be initally false (ie. not shown / none) var max = 7; var shown = new Array(); for (var i=1;i<=max;i++) { shown = false; } } function blocking(i) { if (!supported) { alert('Sorry, this link does not work in your browser.'); return; } // reverse current state shown = (shown) ? false : true; // set css display value current = (shown) ? 'block' : 'none'; // set currentimg = (shown) ? 'on' : 'off'; if (document.getElementById) { document.getElementById('comment_'+i).style.display = current; } else if (document.all) { document.all['comment_'+i].style.display = current; } } Then, whenever you want an 'expand' doovy, use this code:<a href="" onClick="blocking(RANDOM NUMBER); return false">Click me to expand</a> <div class="comment_off" id="comment_RANDOM NUMBER"> Whatever you want to reveal here </div> Then ensure you have this CSS code on all your pagescomment_off { display: none; } You'll also need to link your HTML file to the javascript file in the HEAD part of your document (template is best), like this: <script language="javascript" type="text/javascript" src="/asset/script/global.js"></script> This assumes your javascript file is in a folder asseet/script. Hope this helps! Regards, Rich
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Mini sitemap. These are the main areas of our web site. Full sitemap. |
© 2008 Best STL. All
Rights Reserved. A Microsoft software training company.
info (at) microsofttraining (dot) net
All prices offered for business users and exclude VAT. E&OE · Terms
and Conditions