|
|
Line 11: |
Line 11: |
| | | |
| <script type="text/javascript"> | | <script type="text/javascript"> |
- | if (document.getElementsByClassName == undefined) {
| + | document.getElementById("chk").onclick = function() { |
- | // only needed for old browsers like IE8 and earlier
| + | if(this.checked) |
- | // http://www.snipplr.com/view/45280/getelementsbyclassname/
| + | document.getElementById('mail_delete_button').style.display = "block"; |
- | document.getElementsByClassName = function(className, node) {
| + | else |
- | if(!node) node = document.getElementsByTagName("body")[0]; | + | document.getElementById('mail_delete_button').style.display = "none"; |
- | var a = [];
| + | |
- | var re = new RegExp('\\b' + className + '\\b');
| + | |
- | var els = node.getElementsByTagName("*");
| + | |
- | for(var i=0,j=els.length; i<j; i++)
| + | |
- | if(re.test(els[i].className))a.push(els[i]);
| + | |
- | return a;
| + | |
- | }
| + | |
- | }
| + | |
- |
| + | |
- | function toggle(theClass, display) {
| + | |
- | var elems = document.getElementsByClassName(theClass);
| + | |
- | var state = document.getElementById("state");
| + | |
- | for (var i=0; i<elems.length; i++)
| + | |
- | elems[i].style.display = display;
| + | |
- | if (display == "block")
| + | |
- | state.innerHTML = "All Descriptions Shown"; | + | |
- | else state.innerHTML = "Classed Descriptions Hidden";
| + | |
- | }
| + | |
- |
| + | |
- | document.getElementById("cbox").onclick = function() { | + | |
- | if (this.checked) toggle("descr", "block");
| + | |
- | else toggle("descr", "none");
| + | |
| } | | } |
| </script> | | </script> |
Line 98: |
Line 77: |
| <div id="main_contant" style="height:500px;"> | | <div id="main_contant" style="height:500px;"> |
| | | |
- | <form>
| + | <input type='checkbox' name='delete_convos[]' value='{$pms[pm_loop].pmconvo_id}' id="chk"> |
- | <fieldset>
| + | <div id="mail_delete_button" style="display: none;">asdf</div> |
- | <label for="cbox" id="state">All Descriptions Shown</label>
| + | |
- | <input id="cbox" type="checkbox" checked="cunhecked" />
| + | |
- | </fieldset>
| + | |
- | </form>
| + | |
- | <ul>
| + | |
- | <li class="descr">Hello This is #1 (can be toggled)</li>
| + | |
- | <li class="descr">Hello This is #2 (can be toggled)</li>
| + | |
- | <li class="descr">Hello This is #3 (can be toggled)</li>
| + | |
- | <li>Hello This is #4 (cannot be toggled)</li>
| + | |
- | </ul> | + | |
| | | |
| | | |