|
| 1 | +/* DHTML-Bibliothek (based on SelfHTML) */ |
| 2 | + |
| 3 | +var DHTML = false, DOM = false, MSIE4 = false, NS4 = false, OP = false; |
| 4 | + |
| 5 | +if (document.getElementById) { |
| 6 | + DHTML = true; |
| 7 | + DOM = true; |
| 8 | +} else { |
| 9 | + if (document.all) { |
| 10 | + DHTML = true; |
| 11 | + MSIE4 = true; |
| 12 | + } else { |
| 13 | + if (document.layers) { |
| 14 | + DHTML = true; |
| 15 | + NS4 = true; |
| 16 | + } |
| 17 | + } |
| 18 | +} |
| 19 | +if (window.opera) { |
| 20 | + OP = true; |
| 21 | +} |
| 22 | + |
| 23 | +function getElement (Mode, Identifier, ElementNumber) { |
| 24 | + var Element, ElementList; |
| 25 | + if (DOM) { |
| 26 | + if (Mode.toLowerCase() == "id") { |
| 27 | + Element = document.getElementById(Identifier); |
| 28 | + if (!Element) { |
| 29 | + Element = false; |
| 30 | + } |
| 31 | + return Element; |
| 32 | + } |
| 33 | + if (Mode.toLowerCase() == "name") { |
| 34 | + ElementList = document.getElementsByName(Identifier); |
| 35 | + Element = ElementList[ElementNumber]; |
| 36 | + if (!Element) { |
| 37 | + Element = false; |
| 38 | + } |
| 39 | + return Element; |
| 40 | + } |
| 41 | + if (Mode.toLowerCase() == "tagname") { |
| 42 | + ElementList = document.getElementsByTagName(Identifier); |
| 43 | + Element = ElementList[ElementNumber]; |
| 44 | + if (!Element) { |
| 45 | + Element = false; |
| 46 | + } |
| 47 | + return Element; |
| 48 | + } |
| 49 | + return false; |
| 50 | + } |
| 51 | + if (MSIE4) { |
| 52 | + if (Mode.toLowerCase() == "id" || Mode.toLowerCase() == "name") { |
| 53 | + Element = document.all(Identifier); |
| 54 | + if (!Element) { |
| 55 | + Element = false; |
| 56 | + } |
| 57 | + return Element; |
| 58 | + } |
| 59 | + if (Mode.toLowerCase() == "tagname") { |
| 60 | + ElementList = document.all.tags(Identifier); |
| 61 | + Element = ElementList[ElementNumber]; |
| 62 | + if (!Element) { |
| 63 | + Element = false; |
| 64 | + } |
| 65 | + return Element; |
| 66 | + } |
| 67 | + return false; |
| 68 | + } |
| 69 | + if (NS4) { |
| 70 | + if (Mode.toLowerCase() == "id" || Mode.toLowerCase() == "name") { |
| 71 | + Element = document[Identifier]; |
| 72 | + if (!Element) { |
| 73 | + Element = document.anchors[Identifier]; |
| 74 | + } |
| 75 | + if (!Element) { |
| 76 | + Element = false; |
| 77 | + } |
| 78 | + return Element; |
| 79 | + } |
| 80 | + if (Mode.toLowerCase() == "layerindex") { |
| 81 | + Element = document.layers[Identifier]; |
| 82 | + if (!Element) { |
| 83 | + Element = false; |
| 84 | + } |
| 85 | + return Element; |
| 86 | + } |
| 87 | + return false; |
| 88 | + } |
| 89 | + return false; |
| 90 | +} |
| 91 | + |
| 92 | +function getAttribute (Mode, Identifier, ElementNumber, AttributeName) { |
| 93 | + var Attribute; |
| 94 | + var Element = getElement(Mode, Identifier, ElementNumber); |
| 95 | + if (!Element) { |
| 96 | + return false; |
| 97 | + } |
| 98 | + if (DOM || MSIE4) { |
| 99 | + Attribute = Element.getAttribute(AttributeName); |
| 100 | + return Attribute; |
| 101 | + } |
| 102 | + if (NS4) { |
| 103 | + Attribute = Element[AttributeName] |
| 104 | + if (!Attribute) { |
| 105 | + Attribute = false; |
| 106 | + } |
| 107 | + return Attribute; |
| 108 | + } |
| 109 | + return false; |
| 110 | +} |
| 111 | + |
| 112 | +function getContent (Mode, Identifier, ElementNumber) { |
| 113 | + var Content; |
| 114 | + var Element = getElement(Mode, Identifier, ElementNumber); |
| 115 | + if (!Element) { |
| 116 | + return false; |
| 117 | + } |
| 118 | + if (DOM && Element.firstChild) { |
| 119 | + if (Element.firstChild.nodeType == 3) { |
| 120 | + Content = Element.firstChild.nodeValue; |
| 121 | + } else { |
| 122 | + Content = ""; |
| 123 | + } |
| 124 | + return Content; |
| 125 | + } |
| 126 | + if (MSIE4) { |
| 127 | + Content = Element.innerText; |
| 128 | + return Content; |
| 129 | + } |
| 130 | + return false; |
| 131 | +} |
| 132 | + |
| 133 | +function getCheck (Mode, Identifier, ElementNumber) { |
| 134 | + var Check; |
| 135 | + var Element = getElement(Mode, Identifier, ElementNumber); |
| 136 | + if (!Element) { |
| 137 | + return false; |
| 138 | + } |
| 139 | + if (DOM) { |
| 140 | + Check = Element.checked; |
| 141 | + return Check; |
| 142 | + } |
| 143 | + if (MSIE4) { |
| 144 | + Check = Element.checked; |
| 145 | + return Check; |
| 146 | + } |
| 147 | + return false; |
| 148 | +} |
| 149 | + |
| 150 | +function setCheck (Mode, Identifier, ElementNumber) { |
| 151 | + var Element = getElement(Mode, Identifier, ElementNumber); |
| 152 | + if (!Element) { |
| 153 | + return false; |
| 154 | + } |
| 155 | + if (DOM) { |
| 156 | + Element.checked = true; |
| 157 | + return true; |
| 158 | + } |
| 159 | + if (MSIE4) { |
| 160 | + Element.checked = true; |
| 161 | + return true; |
| 162 | + } |
| 163 | + if (NS4) { |
| 164 | + Element.document.open(); |
| 165 | + Element.document.write(true); |
| 166 | + Element.document.close(); |
| 167 | + return true; |
| 168 | + } |
| 169 | +} |
| 170 | + |
| 171 | +function clearCheck (Mode, Identifier, ElementNumber) { |
| 172 | + var Element = getElement(Mode, Identifier, ElementNumber); |
| 173 | + if (!Element) { |
| 174 | + return false; |
| 175 | + } |
| 176 | + if (DOM) { |
| 177 | + Element.checked = false; |
| 178 | + return true; |
| 179 | + } |
| 180 | + if (MSIE4) { |
| 181 | + Element.checked = false; |
| 182 | + return true; |
| 183 | + } |
| 184 | + if (NS4) { |
| 185 | + Element.document.open(); |
| 186 | + Element.document.write(false); |
| 187 | + Element.document.close(); |
| 188 | + return true; |
| 189 | + } |
| 190 | +} |
| 191 | + |
| 192 | +function setContent (Mode, Identifier, ElementNumber, Text) { |
| 193 | + var Element = getElement(Mode, Identifier, ElementNumber); |
| 194 | + if (!Element) { |
| 195 | + return false; |
| 196 | + } |
| 197 | + if (DOM && Element.firstChild) { |
| 198 | + Element.firstChild.nodeValue = Text; |
| 199 | + return true; |
| 200 | + } |
| 201 | + if (MSIE4) { |
| 202 | + Element.innerText = Text; |
| 203 | + return true; |
| 204 | + } |
| 205 | + if (NS4) { |
| 206 | + Element.document.open(); |
| 207 | + Element.document.write(Text); |
| 208 | + Element.document.close(); |
| 209 | + return true; |
| 210 | + } |
| 211 | +} |
| 212 | + |
| 213 | +function setAttribute (Mode, Identifier, ElementNumber, AttributeName, AttributeWert) { |
| 214 | + var Element = getElement(Mode, Identifier, ElementNumber); |
| 215 | + if (!Element) { |
| 216 | + return false; |
| 217 | + } |
| 218 | + if (DOM || MSIE4) { |
| 219 | + Element.setAttribute(AttributeName, AttributeWert); |
| 220 | + return true; |
| 221 | + } |
| 222 | +// if (NS4) { |
| 223 | +// Attribute = Element[AttributeName] |
| 224 | +// if (!Attribute) { |
| 225 | +// Attribute = false; |
| 226 | +// } |
| 227 | +// return true; |
| 228 | +// } |
| 229 | + return false; |
| 230 | +} |
0 commit comments