I seem to be having problems with some javascript I made. WARNING: the javascript I will show you uses Prototype.js || I will also include the page source in case it helps.
Javascript:
and the html:Code:// pulldownExample javascript var handl = { //pulldown handler pdh: function(e){ var desArray = e.descendants(); desArray.each(function(item){ if (item.hasClassName('hidden') == true){ item.removeClassName('hidden'); item.addClassName('shown'); } else if (item.hasClassName('shown') == true){ item.removeClassName('shown'); item.addClassName('hidden'); } }); }}; $('outer').observe('click', handl.pdh.bindAsEventListener(obj));
The point is to make the hidden div appear when the user clicks on the 'outer' div.Code:<title>Pulldown Link Example</title> <script type="text/javascript" src="prototype.js"></script> <style type="text/css"> <!-- #outer div.more a { display: none; } #outer div.click a { display: inline; } div.hidden { display: none; } div.shown { display: inline; } div#outer { width: 100%; } --> </style> <script type="text/javascript" src="pulldownExample.js"></script> </head> <body> <div id="outer"> <a>Lorem</a> <div class="hidden"> <a>Ipsum</a><br /> <a>Dolor</a> </div> </div> </body> </html>
Both firebug and the Firefox error console tell me that "$('outer') has no properties".
I don't quite understand, so could someone possibly help me out??
EDIT: please delete this post. I'm moving over to the scripting forum


LinkBack URL
About LinkBacks

