PDA

View Full Version : Hotkey to Expand/Contract



gc40
04-21-2007, 02:29 PM
Greetings,
I am using this script:

http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm

I would like to be able to press "c" on my keyboard and all the switch content contracts.

How would I implement such things into my script to get it to work?

jscheuer1
04-21-2007, 03:40 PM
Put his in the head after the call to the switchcontent.js file.


<script type="text/javascript">
document.onkeydown=function(e){
var e=window.event? window.event : e;
if(e.keyCode=="C".charCodeAt(0))
bobexample.sweepToggle('contract')
else if(e.keyCode=="E".charCodeAt(0))
bobexample.sweepToggle('expand')
}
</script>

bobexample (here from the demo markup) refers to the switchcontent instance.