CKEditor word count
There are a couple of ways you may want to do this – I’ve described two below. The first is a word count that runs itself and updates a value somewhere on the page, the second a word count initiated […]
There are a couple of ways you may want to do this – I’ve described two below. The first is a word count that runs itself and updates a value somewhere on the page, the second a word count initiated […]
Well, this was a total pain in the arse!! So my netbook suddenly died, I’ve just arrived in a foreign country and no mr microsoft, I neither have a cd drive (nor my windows cd) and I don’t trust giving […]
JavaScript code to generate a document map/table of contents from the document structure. NB – Sorry I need to update this to get the examples working in WordPress This page generates the following document map: [jscript]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
[brushjs] function get_my_navigation(use_body, html_text, do_bookmarks, heading_level, show_level) { //var all_elements = document.getElementsByTagName("*"); var all_elements; if (use_body == 1) all_elements = document.getElementsByTagName("*"); else if (html_text!=""){ html_div = document.createElement("div"); html_div.innerHTML = html_text; all_elements = html_div.getElementsByTagName("*"); } if ((heading_level==null) || (heading_level=="")) heading_level=3; if (show_level==null) show_level=0; var hopen="<h"+heading_level+">"; var hclose="</h"+heading_level+">"; structure = ""; first_level = 0; level_no = 0; this_level = 0; last_level = 0; current_level = 0; for (i = 0; i < all_elements.length; i++) { h_message = ""; element_text = ""; a = all_elements[i]; if (document.all) { element_text = a.innerText; } else { element_text = a.textContent; } node_name = all_elements[i].nodeName; if (node_name == "H1" || node_name == "H2" || node_name == "H3" || node_name == "H4" || node_name == "H5" || node_name == "H6") { level_no++; this_level = parseInt(all_elements[i].nodeName.substring(1, 2)); if (level_no == 1) first_level = this_level; if (show_level==1) element_text+=" ("+this_level+")"; // if we are bookmarking the contents if (do_bookmarks==1) element_text = "<a href='#generated_link_" + i + "'>" + element_text + "</a>"; if (this_level == last_level) { if (first_level == this_level) structure += hopen + element_text + hclose; else structure += "<li>" + element_text + "</li>"; } else if (this_level > last_level) { current_level++; difference = this_level - last_level; if (difference > 1) { h_message = " (bad heading structure)</li>"; } if (first_level == this_level) structure += hopen + element_text + hclose; else structure += "<ul><li>" + element_text + h_message + "</li>"; } else if (this_level < last_level) { difference = last_level - this_level; for (z = 0; z < difference; z++) { current_level--; structure += "</ul>"; } structure += "</ul>"; if (current_level < 0) structure += "<li>" + element_text + "</li> (bad heading structure)"; else { if (first_level == this_level) structure += hopen + element_text + hclose; else structure += "<ul><li>" + element_text + "</li>"; } } if (do_bookmarks == 1) { var lnk = document.createElement("a"); lnk.name = "generated_link_" + i; lnk.id = "generated_link_" + i; all_elements[i].appendChild(lnk); } last_level = this_level; } } for (z = 0; z < current_level; z++) { structure += "</ul>"; } return structure; } |
You’ll want a […]
If you are inserting/updating multiple rows in a database and you need to do some processing on the inserted data you may need to add a bit of recursion to your trigger code to handle each record corretly. The example […]
So to create alternate coloured rows in SSRS we create an expression on the background property of the row data:
1 |
=iif(RowNumber(Nothing) Mod 2, "WhiteSmoke", "White") |
I found myself wanting to apply the alternating colour not to each row, but to each group to make […]