tag:blogger.com,1999:blog-3760169963830810897.post4990276075737930078..comments2023-03-26T21:00:59.091+01:00Comments on Code Butchering: [Javascript] Change HTML "class" and "style" attributesAnonymoushttp://www.blogger.com/profile/13431481971279629409noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-3760169963830810897.post-5382614139080885142008-07-12T22:12:00.000+01:002008-07-12T22:12:00.000+01:00thanks people this helps a lotthanks people this helps a lotUnknownhttps://www.blogger.com/profile/00689392775446612792noreply@blogger.comtag:blogger.com,1999:blog-3760169963830810897.post-5003690819046112972008-02-01T16:44:00.000+00:002008-02-01T16:44:00.000+00:00Max you are right!I copied & pasted the code from ...Max you are right!<BR/>I copied & pasted the code from an old script I wrote; actually it was used to test IE and Firefox only, supposing no other browser could be used, as my company installed all the software (including browser).<BR/>Anyway you are right :)<BR/>Moreover I suppose that with Opera, Safari and etc. the isMozilla flag would be selected to TRUE. Do you think so?<BR/>Anyway thanx for your comment!Enrico Murruhttps://www.blogger.com/profile/13544715040561543958noreply@blogger.comtag:blogger.com,1999:blog-3760169963830810897.post-71424418935878345482008-02-01T16:37:00.000+00:002008-02-01T16:37:00.000+00:00Actually, I want to comment on your source code.Th...Actually, I want to comment on your source code.<BR/><BR/>This isn't the best approach. You are excluding all other standards compliant browsers!<BR/><BR/>try this instead.<BR/><BR/>var isIE = (window.ActiveXObject)?true:false;<BR/>//no need to define Mozilla<BR/><BR/>if(!isIE){<BR/> div.setAttribute('style',styleString);<BR/>} else {<BR/> div.style.cssText = styleString;<BR/>}<BR/><BR/>//you don't want "else if()" because you'll exclude Safari, Opera, Konqueror and all other browsers.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-3760169963830810897.post-27479046822702123632008-02-01T16:32:00.000+00:002008-02-01T16:32:00.000+00:00Nice blog you got there.Thanks for pointing out.Ch...Nice blog you got there.<BR/><BR/>Thanks for pointing out.<BR/><BR/>CheersAnonymoushttps://www.blogger.com/profile/13431481971279629409noreply@blogger.comtag:blogger.com,1999:blog-3760169963830810897.post-12885734738583495222008-02-01T16:27:00.000+00:002008-02-01T16:27:00.000+00:00These 2 bugs and many more in IE are discussed (wi...These 2 bugs and many more in IE are discussed (with workarounds) over on Web Bug Track.<BR/><BR/>Bug 242:<BR/>http://webbugtrack.blogspot.com/2007/08/bug-242-setattribute-doesnt-always-work.html<BR/><BR/>If you can not list 6 IE JavaScript bugs off the top of your head, then you need to take a peek. Its unbelievable how many nasty bugs there are.Anonymousnoreply@blogger.com