search
HomeWeb Front-endHTML TutorialHTML图片切换和文字滚动互相影响了。。。_html/css_WEB-ITnose

HTML javascript css 图片切换 web

我做的网站主页上有个文字滚动的模块,还有个图片切换的模块,图片切换实在网上找的代码,文字滚动自己写的,下面的代码复制粘贴就能使用。 有这么个问题这俩个模块互相影响了,图片切换模块一切换图片,我的文字滚动就停顿一下很郁闷,求大神帮解决
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>图片幻灯切换</title><style type="text/css">#ibanner { position:relative; width:280px; height:200px; overflow:hidden; margin:0; padding:0; }#ibanner_pic {}#ibanner_pic a { position:absolute; top:0px; border:0px #FFF; display:block; width:280px; height:200px; overflow:hidden; margin:0px; padding:0; }#ibanner_btn { position:absolute; z-index:9999; right:5px; bottom:5px; font-weight:700; font-family:Arial; }#ibanner_btn span { display:block; float:left; margin-left:4px; padding:0 5px; background:#000; cursor:pointer; }#ibanner_btn .normal { height:20px; margin-top:8px;  color:#999; font-size:16px; line-height:20px; }#ibanner_btn .current { height:28px;  color:#FF5300; font-size:28px; line-height:28px; }</style><script type="text/javascript">function $(id) { return document.getElementById(id); }function addLoadEvent(func){var oldonload = window.onload;if (typeof window.onload != 'function') {window.onload = func;} else {window.onload = function(){oldonload();func();}}}function addBtn() {if(!$('ibanner')||!$('ibanner_pic')) return;var picList = $('ibanner_pic').getElementsByTagName('a');if(picList.length==0) return;var btnBox = document.createElement('div');btnBox.setAttribute('id','ibanner_btn');var SpanBox ='';for(var i=1; i<=picList.length; i++ ) {var spanList = '<span class="normal">'+i+'</span>';SpanBox += spanList;}btnBox.innerHTML = SpanBox;$('ibanner').appendChild(btnBox);$('ibanner_btn').getElementsByTagName('span')[0].className = 'current';for (var m=0; m<picList.length; m++){var attributeValue = 'picLi_'+mpicList[m].setAttribute('id',attributeValue);}}function moveElement(elementID,final_x,final_y,interval) {if (!document.getElementById) return false;if (!document.getElementById(elementID)) return false;var elem = document.getElementById(elementID);if (elem.movement) {clearTimeout(elem.movement);}if (!elem.style.left) {elem.style.left = "0px";}if (!elem.style.top) {elem.style.top = "0px";}var xpos = parseInt(elem.style.left);var ypos = parseInt(elem.style.top);if (xpos == final_x && ypos == final_y) {moveing = false;return true;}if (xpos < final_x) {var dist = Math.ceil((final_x - xpos)/10);xpos = xpos + dist;}if (xpos > final_x) {var dist = Math.ceil((xpos - final_x)/10);xpos = xpos - dist;}if (ypos < final_y) {var dist = Math.ceil((final_y - ypos)/10);ypos = ypos + dist;}if (ypos > final_y) {var dist = Math.ceil((ypos - final_y)/10);ypos = ypos - dist;}elem.style.left = xpos + "px";elem.style.top = ypos + "px";var repeat = "moveElement('"+elementID+"',"+final_x+","+final_y+","+interval+")";elem.movement = setTimeout(repeat,interval);}function classNormal() {var btnList = $('ibanner_btn').getElementsByTagName('span');for (var i=0; i<btnList.length; i++){btnList[i].className='normal';}}function picZ() {var picList = $('ibanner_pic').getElementsByTagName('a');for (var i=0; i<picList.length; i++){picList[i].style.zIndex='1';}}var autoKey = false;function iBanner() {if(!$('ibanner')||!$('ibanner_pic')||!$('ibanner_btn')) return;$('ibanner').onmouseover = function(){autoKey = true};$('ibanner').onmouseout = function(){autoKey = false};var btnList = $('ibanner_btn').getElementsByTagName('span');var picList = $('ibanner_pic').getElementsByTagName('a');if (picList.length==1) return;picList[0].style.zIndex='2';for (var m=0; m<btnList.length; m++){btnList[m].onmouseover = function() {for(var n=0; n<btnList.length; n++) {if (btnList[n].className == 'current') {var currentNum = n;}}classNormal();picZ();this.className='current';picList[currentNum].style.zIndex='2';var z = this.childNodes[0].nodeValue-1;picList[z].style.zIndex='3';if (currentNum!=z){picList[z].style.left='650px';moveElement('picLi_'+z,0,0,10);}}}}setInterval('autoBanner()', 5000);function autoBanner() {if(!$('ibanner')||!$('ibanner_pic')||!$('ibanner_btn')||autoKey) return;var btnList = $('ibanner_btn').getElementsByTagName('span');var picList = $('ibanner_pic').getElementsByTagName('a');if (picList.length==1) return;for(var i=0; i<btnList.length; i++) {if (btnList[i].className == 'current') {var currentNum = i;}}if (currentNum==(picList.length-1) ){classNormal();picZ();btnList[0].className='current';picList[currentNum].style.zIndex='2';picList[0].style.zIndex='3';picList[0].style.left='650px';moveElement('picLi_0',0,0,10);} else {classNormal();picZ();var nextNum = currentNum+1;btnList[nextNum].className='current';picList[currentNum].style.zIndex='2';picList[nextNum].style.zIndex='3';picList[nextNum].style.left='650px';moveElement('picLi_'+nextNum,0,0,10);}}addLoadEvent(addBtn);addLoadEvent(iBanner);</script></head><body><div id="ibanner"><div id="ibanner_pic"><a href="/jscss/"><img src="/static/imghwm/default1.png"  data-src="http://su.bdimg.com/static/skin/img/logo_white.png"  class="lazy"    style="max-width:90%"   alt="" /></a><a href="/sort/index.shtml"><img src="/static/imghwm/default1.png"  data-src="http://su.bdimg.com/static/skin/img/logo_white.png"  class="lazy"    style="max-width:90%"  alt="" /></a><a href="/other/lastupdate.shtml"><img src="/static/imghwm/default1.png"  data-src="http://su.bdimg.com/static/skin/img/logo_white.png"  class="lazy"    style="max-width:90%"  alt="" /></a><a href="/other/top100.shtml"><img src="/static/imghwm/default1.png"  data-src="http://su.bdimg.com/static/skin/img/logo_white.png"  class="lazy"    style="max-width:90%"  alt="" /></a></div></div>      <marquee onMouseOver="this.stop()" onMouseOut="this.start()" id="mar" direction="left" width="870px" height="42px" style="font-size:24px; line-height:42px;" scrolldelay=0 scrollamount=4 >      图片切换在上面的div里adsasdadadasdasdsaddjjjjjjjjjjjjjjjjjjjjjjjjjaskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkklllllllllllllllll这是要滚动的文字      </marquee>  </body></html>

用IE或者搜狗浏览器可以发现一卡一卡的问题,谷歌和火狐没问题、正常显示。
大家新建个记事本把代码拷进去,html保存,就ok了,图片路径我改成网络图片了。直接运行。
或者谁有现成的,给我发个,要求这两个模块不互相影响就行谢谢

回复讨论(解决方案)

要怎么改才行呢??

谁来就给谁分了

marquee 做出来的滚动效果不太理想吧.
如果楼主会多出使用 滚动,tab等模块.
给你推荐一款插件 msclass.js

marquee 做出来的滚动效果不太理想吧.
如果楼主会多出使用 滚动,tab等模块.
给你推荐一款插件 msclass.js
分给你了,要不然没办法提问

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The Role of HTML: Structuring Web ContentThe Role of HTML: Structuring Web ContentApr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTML and Code: A Closer Look at the TerminologyHTML and Code: A Closer Look at the TerminologyApr 10, 2025 am 09:28 AM

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS, and JavaScript: Essential Tools for Web DevelopersHTML, CSS, and JavaScript: Essential Tools for Web DevelopersApr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

The Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesThe Roles of HTML, CSS, and JavaScript: Core ResponsibilitiesApr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Is HTML easy to learn for beginners?Is HTML easy to learn for beginners?Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is an example of a starting tag in HTML?What is an example of a starting tag in HTML?Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools