Note: Gets the specified style element in the style array of the DOM element
Copy Code code as follows:
function Elementgetstyle (element, style) {
var value = null;
if (Element.style) {
Value = Element.style[style];
}
if (!value) {
if (Document.defaultview && document.defaultView.getComputedStyle) {
var css = Document.defaultView.getComputedStyle (element, NULL);
Value = CSS? Css.getpropertyvalue (style): null;
else if (Element.currentstyle) {
Value = Element.currentstyle[style];
}
}
/** DGF necessary?
if (Window.opera && [' left], ' top ', ' right ', ' bottom '].include (style))
if (Element.getstyle (Element, ' position ') = = ' static ') value = ' auto '; */
return value = = ' Auto '? Null:value;
}
Note: The selected DOM element is highlighted in color color 0.2s
Copy Code code as follows:
function Uiwebhighlight (element,color) {
if (!element) {return}
var highlightcolor = "Yellow";
if (color) {HighlightColor = color}
if (Element.originalcolor = = undefined) {//Avoid picking up highlight
Element.originalcolor = Elementgetstyle (element, "Background-color");
}
Elementsetstyle (element, {"BackgroundColor": HighlightColor});
Window.settimeout (function () {
try {
If element is orphan, probably page of it has already gone, so ignore
if (!element.parentnode) {
Return
}
Elementsetstyle (element, {"BackgroundColor": Element.originalcolor});
catch (e) {}//DGF unhighlighting is very dangerous and low priority
}, 200);
}