Tip: you can modify some code before running
JavaScript images seamlessly scroll to the left<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"><html xmlns="http://www.111cn.net/1999/xhtml"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta http-equiv="x-ua-compatible" content="ie=emulateie7" /><title>JavaScript images seamlessly scroll to the left</title><style type="text/css">* {Padding: 0; margin: 0; font: 12px tahoma; text-decoration: none ;}# marqueediv {width: 400px; height: 120px; overflow: hidden; background: # cccccc; margin: 0 auto; position: relative ;}# marqueetable {position: absolute ;}# marqueediv table tr td img {border: 1px solid black ;} # marqueediv table tr td a {display: block; text-align: center ;}</style></head><body><div id="marqueediv"> <table id="marqueetable"> <tr id="tr1"> <td>Search</td> <td>Search B</td> </tr> </table> </div></body></html><script language="javascript" type="text/javascript">Function $ (obj) {return document. getelementbyid (obj);} var marqueewidth = parseint ($ ("tr1 "). offsetwidth); var tempwidth = 0; var timevar; function marqueeleft () {tempwidth = tempwidth-1; $ ("marqueetable "). style. left = tempwidth + "px"; if (math. abs (tempwidth) = marqueewidth) {$ ("marqueetable "). style. left = "0px"; tempwidth = 0 ;}} window. onload = function () {var tr = $ ("tr1"); var sourcetds = tr. getelementsbytagname ("td"); var sourcetds_length = sourcetds. length; var copytd; for (var I = 0; I <sourcetds_length; I ++) {copytd = tr. insertcell (-1); // The-1 identifier is added to the end of copytd. innerhtml = sourcetds [I]. innerhtml;} timevar = setinterval (marqueeleft, 30 );}</script>
Tip: you can modify some code before running