function getElementsByClass(searchClass,tagName) { var html' target='_blank'>classElements = new Array(); if ( tagName == null ) tagName = '*'; var els = document.getElementsByTagName(tagName); var elsLen = els.length; var pattern = new RegExp( (^|/s) searchClass (/s|$) for (i = 0, j = 0; i elsLen; i ) { if ( pattern.test(els[i].className) ) { classElements[j] = els[i]; j ; } } return classElements; }
function ccMarquee(className){ var a=getElementsByClass(className); for (i = 0; i a.length; i ) { a[i].innerHTML= marquee a[i].innerHTML /marquee } }window.onload = function () { ccMarquee( ccMarquee } XHTML代码:
div > a href= title= 这里是滚动的 /a /div 请大家注重,需要用到滚动效果的地方只要在其何外围的标签上加上 > 附: marquee 标签属性详解