diff options
-rw-r--r-- | itjs/it.js | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -132,6 +132,25 @@ function it_get_obj_y(obj) return curtop; } +/* Common accessor for dom elements */ +function it_find_obj(obj) +{ + if (document.getElementById) + return document.getElementById(obj); + else if (document.all) + return document.all[obj]; + else if (document.layers) + return document.layers[obj]; + return null; +} + +/* Get dom element by ID but always return a valid object */ +function it_element(label) +{ + var tmp = it_find_obj(label); + return tmp ? tmp : {style:{}, src:""}; +} + /* Get an iframe's content document in a compatible way */ function it_get_iframe_document(iframe) { |