function getsupportedprop(proparray){ var root=document.documentElement; //reference root element of document for (var i=0; i<proparray.length; i++){ //loop through possible properties if (proparray[i] in root.style){ //if property exists on element (value will be string, empty string if not set) return proparray[i]; //return that string } } } var boxshadowprop=getsupportedprop([ ‘OBoxShadow‘,‘WebkitTransform‘,‘MozTransform‘]);
时间: 2024-11-05 12:26:58