【代码优化】避免CSS表达式而选择一次性表达式
<style> p { background-color: expression(altBgcolor(this)); } </style> <script type="text/javascript"> function altBgcolor(elem){ elem.style.backgroundColor=(new Date()).getHours()%2?"#F08A00":"#B8D4FF"; } </script>
<style> p { background-color: expression(altBgcolor(this)); } </style> <script type="text/javascript"> function altBgcolor(elem){ elem.style.backgroundColor=(new Date()).getHours()%2?"#F08A00":"#B8D4FF"; } </script>