|
Behaviour and scriptaculous: msg#00143lang.ruby.rails.spinoffs
I have a <div> that I want to toggle its visibility. I have "hide" text which makes it hide an makes the text "show" visible. My problem is I don't want the "hide" text to display if javascript is disabled. So it starts out as display:none. I can then make it visible by window.onload. The problem is when I use the onload handler then the text does display at startup, but clicking on it has no effect. This is what I tried: <div id="hiddentable"> <span id="tablehide" style="display:none;">Hide Table</span> (( show table here )) <span id="tableshow" style="display:none;">Show Table</span> </div> I'm using Behaviour to register the javascript: /* make the "hide" text visible if javascript is enabled */ /* this makes the "hide" text not do anything -- comment out and works */ window.onload = function() { new Effect.Appear(document.getElementById('tablehide')); } var hide_rules = { '#tablehide' : function(e) { e.onclick = function() { new Effect.BlindUp(document.getElementById('hiddentable')); new Effect.Appear(document.getElementById('tableshow')); } }, '#tableshow' : function(e) { e.onclick = function() { new Effect.BlindDown(document.getElementById('hiddentable')); new Effect.Fade(this); } }, }; Behaviour.register(hide_rules); I'm reasonably new to Behaviour/Prototype/Scriptaculous, in case you were wondering... -- Bill Moseley moseley-kv6DSSSScSo@xxxxxxxxxxxxxxxx |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Ajax and Rails to manage long running server process (and file download)?: 00143, Stuart Hungerford |
|---|---|
| Next by Date: | InPlaceEditor form value: 00143, Brandon Dove |
| Previous by Thread: | Ajax and Rails to manage long running server process (and file download)?i: 00143, Stuart Hungerford |
| Next by Thread: | InPlaceEditor form value: 00143, Brandon Dove |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |