[geeklog-cvs] Geeklog-1.x/public_html/javascript common.js, 1.1, 1.2
Blaine Lang
blaine at qs1489.pair.com
Sun Oct 28 12:22:45 EDT 2007
Update of /cvsroot/geeklog/Geeklog-1.x/public_html/javascript
In directory qs1489.pair.com:/tmp/cvs-serv4032
Modified Files:
common.js
Log Message:
Added 2 common Javascript utility functions to toggle (show/hide) elements
Index: common.js
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/javascript/common.js,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** common.js 20 Aug 2006 03:38:38 -0000 1.1
--- common.js 28 Oct 2007 16:22:42 -0000 1.2
***************
*** 46,47 ****
--- 46,73 ----
}
}
+
+
+
+
+ // Basic function to show/hide (toggle) an element - pass in the elment id
+ function elementToggle(id) {
+ var obj = document.getElementById(id);
+ if (obj.style.display == 'none') {
+ obj.style.display = '';
+ } else {
+ obj.style.display = 'none';
+ }
+ }
+
+ // Basic function to show/hide an element - pass in the elment id and option.
+ // Where option can be: show or hide or toggle
+ function elementShowHide(id,option) {
+ var obj = document.getElementById(id);
+ if (option == 'hide') {
+ obj.style.display = 'none';
+ } else if (option == 'show') {
+ obj.style.display = '';
+ } else if (option == 'toggle') {
+ elementToggle(id);
+ }
+ }
\ No newline at end of file
More information about the geeklog-cvs
mailing list