WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : A scroller like the 'Marquee' , but you can change sense, and it works with NN4.7, IE, and mozilla !!! (opera only when like IE)
Categories : Java Script, HTML Click here to Update Your Picture
Mr Alti
Date : Nov 19th 2001
Grade : 4 of 5 (graded 3 times)
Viewed : 4359
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Mr Alti
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<html>
<head>
<title>Scroller</title>
There a  scroller script in which you can change the scrolling sense and stop it on
mouseover!
<br><br>
<script type="text/javascript">
/**************************************************************************
*
***************************** MADE BY ALTI *********************************
***************************************************************************
/
messages = new Array();

messages[0]=" Accor";
messages[1]=" Thales";
messages[2]=" AGF";
messages[3]=" Air liquide";
messages[4]=" Alcatel";
messages[5]=" Alstom";
messages[6]=" Aventis";
messages[7]=" Axa";
messages[8]=" BNP";
messages[9]=" Bouygues";
messages[10]=" Cap Gemini";
messages[11]=" Carrefour";
messages[12]=" Cr餩t Lyonnais";
messages[13]=" Groupe Casino";
messages[14]=" Dexia";
messages[15]=" Equant";
messages[16]=" France Telecom";
messages[17]=" L\'Or顬";
messages[18]=" Lafarge";
messages[19]=" Lagard貥";
messages[20]=" LVMH";
messages[21]=" Peugeot";
messages[22]=" PPR Group";
messages[23]=" Renault";
messages[24]=" Saint Gobain";
messages[25]=" Sanofi Synthelabo";
messages[26]=" Schneider Electric";
messages[27]=" Soci鴩 g鮩rale";
messages[28]=" ST";
messages[29]=" Suez Lyonnaise des Eaux";
messages[30]=" TF1";
messages[31]=" Total Fina Elf";
messages[32]=" Valeo";
messages[33]=" Eads";
messages[34]=" Thomson mm";
messages[35]=" Vivendi";
messages[36]=" Michelin";
messages[37]=" Dassault";
messages[38]=" Danone";
messages[39]=" Sodexho";

if (messages.length>1) i=2
else i=0

divWidth=300;
divHeight=20;

document.writeln("<style type=text/css>");
document.writeln("#monid
{width:"+divWidth+"px;height:"+divHeight+"px;position:relative;top:0px;}");
document.writeln("#theid {overflow:hidden;clip:rect(0 "+divWidth+" "+divHeight+"
0);left:0;top:0;background-color:#FAFAFA;}");
document.writeln("#theid
{position:absolute;width:"+divWidth+"px;height:"+divHeight+"px;}");
document.writeln("#div2
{position:absolute;width:"+divWidth+";left:0px;height:"+divHeight+"px;top:0;visibilit
y:hidden
;color:#FF5555;}");
document.writeln("#div1
{position:absolute;width:"+divWidth+" ;left:1px;height:"+divHeight+"px;top:0;color:#5
555FF;
font-family:Verdana;font-weight:bold;}");
document.writeln(".turn {font-size:48px;color:black;text-decoration:none;}");
document.writeln("</style>");


function moveLayer(whichdiv,autre,sig,speed,offsetW){
tdiv=eval(whichdiv);
adiv=eval(autre);
tdivstyle=tdiv;
adivstyle=adiv;
gauche="left";
signe=(eval("sig")=='neg')?-1:1
if (eval("parseInt(tdivstyle."+gauche+")")==parseInt(signe)) {
    tdivstyle.left=0;
    actu=setTimeout("moveLayer(tdiv,adiv,'"+sig+"',"+speed+","+offsetW+")",speed)
    return actu
}
if (signe==1) ppp="parseInt(tdivstyle."+gauche+")>=(offsetW*-1)+1"; else
ppp="parseInt
(tdivstyle."+gauche+")<=offsetW+1";
if (eval(ppp)){
    position=eval("parseInt(tdivstyle."+gauche+")-parseInt(signe)");
    tdivstyle.left=position;
} else {
  position=eval((divWidth*parseInt(signe)));
  tdivstyle.left=position;
  tdiv.document.write(messages[i]);
  tdiv.document.close()
if (signe==1) { if (i==messages.length-1) i=0; else i++; } else { if (i<=0)
i=messages.length-
1; else i--; }
};
if (signe==1) ppp="parseInt(adivstyle."+gauche+")<=(offsetW*-1)+1"; else
ppp="parseInt
(adivstyle."+gauche+")>=offsetW+1";
if (eval(ppp)){
    position=eval(divWidth*parseInt(signe));
    adivstyle.left=position;
    adiv.document.write(messages[i]);
    adiv.document.close()
    if (signe==1) { if (i==messages.length-1) i=0; else i++; } else { if (i<=0)
i=messages.length-1; else i--; }
} else {
    position=eval(parseInt(adivstyle.left)-parseInt(signe));
    adivstyle.left=position;
}
actu=setTimeout("moveLayer(tdiv,adiv,'"+sig+"',"+speed+","+offsetW+")",speed)
return actu
}

function moveAll(whichdiv,autre,sig,speed,offsetW){
tdiv=eval(whichdiv);
adiv=eval(autre);
tdivstyle=tdiv.style;
adivstyle=adiv.style;
gauche="pixelLeft";
signe=(eval("sig")=='neg')?-1:1
if (eval("parseInt(tdivstyle."+gauche+")")==parseInt(signe)){
    tdivstyle.left=0;
    actu=setTimeout("moveAll(tdiv,adiv,'"+sig+"',"+speed+","+offsetW+")",speed)
    return actu
}
if (signe==1) ppp="parseInt(tdivstyle."+gauche+")>=(offsetW*-1)+1"; else
ppp="parseInt
(tdivstyle."+gauche+")<=offsetW+1";
if (eval(ppp)){
    position=eval("parseInt(tdivstyle."+gauche+")-parseInt(signe)");
    tdivstyle.pixelLeft=position;
} else {
    position=eval((divWidth*parseInt(signe)));
    tdivstyle.pixelLeft=position;
    tdiv.innerHTML=messages[i];
if (signe==1) { if (i==messages.length-1) i=0; else i++; } else { if (i<=0)
i=messages.length-
1; else i--; }
};
if (signe==1) ppp="parseInt(adivstyle."+gauche+")<=(offsetW*-1)+1"; else
ppp="parseInt
(adivstyle."+gauche+")>=offsetW+1";
if (eval(ppp)){
    position=eval(divWidth*parseInt(signe));
    adivstyle.pixelLeft=position;
    adiv.innerHTML=messages[i];
    if (signe==1) { if (i==messages.length-1) i=0; else i++; } else { if (i<=0)
i=messages.length-1; else i--; }
} else {
    position=eval(parseInt(adivstyle.left)-parseInt(signe));
    adivstyle.pixelLeft=position;
}
actu=setTimeout("moveAll(tdiv,adiv,'"+sig+"',"+speed+","+offsetW+")",speed)
return actu
}

function moveById(whichdiv,autre,sig,speed,offsetW){
tdiv=eval(whichdiv);
adiv=eval(autre);
tdivstyle=tdiv.style;
adivstyle=adiv.style;
gauche="left";
signe=(eval("sig")=='neg')?-1:1
if (eval("parseInt(tdivstyle."+gauche+")")==parseInt(signe)) {
    tdivstyle.left=0+"px";
    actu=setTimeout("moveById(tdiv,adiv,'"+sig+"',"+speed+","+offsetW+")",speed)
    return actu
}
if (signe==1) ppp="parseInt(tdivstyle."+gauche+")>=(offsetW*-1)+1"; else
ppp="parseInt
(tdivstyle."+gauche+")<=offsetW+1";
if (eval(ppp)){
    position=eval("parseInt(tdivstyle."+gauche+")-parseInt(signe)");
    tdivstyle.left=position+"px";
} else {
    doc = document.getElementById("div1");
    chaine=eval("messages["+i+"]");
    textnodea = document.createTextNode(chaine);
    if (doc.firstChild) doc.replaceChild(textnodea,doc.firstChild);
if (signe==1) { if (i==messages.length-1) i=0; else i++; } else { if (i<=0)
i=messages.length-
1; else i--; }
};
if (signe==1) ppp="parseInt(adivstyle."+gauche+")<=(offsetW*-1)+1"; else
ppp="parseInt
(adivstyle."+gauche+")>=offsetW+1";
if (eval(ppp)){
    position=eval(divWidth*parseInt(signe));
    adivstyle.left=position+"px";
    doc = document.getElementById("div2");
    chaine=eval("messages["+i+"]");
    textnodec = document.createTextNode(chaine);
    if (doc.firstChild) doc.replaceChild(textnodec,doc.firstChild);
    if (signe==1) { if (i==messages.length-1) i=0; else i++; } else { if (i<=0)
i=messages.length-1; else i--; }
} else {
    position=eval(parseInt(adivstyle.left)-parseInt(signe));
    adivstyle.left=position+"px";
}
actu=setTimeout("moveById(tdiv,adiv,'"+sig+"',"+speed+","+offsetW+")",speed)
return actu
}

var divok=0;
function tourne(lesens) {
sens=lesens
if (lesens=='neg') {
switch(i) { case 0: i=messages.length-3; break; case 1: i=messages.length-2; break;
default :
i-=2; break; }
} else {
switch(i) { case messages.length-1: i=0; break; case messages.length-2:
i=messages.length-
1; break; default : i+=1; break; }
}
one=(one==1)?2:1
stopmove();
startmove();
}

function stopmove() { clearTimeout(actu); }

function startmove() {
two=(one==1)?2:1
if (document.layers) {
actu=setTimeout("moveLayer
(document.main.document.layer"+one+",document.main.document.layer"+two+",'"+sens+"',v
it
esse,divWidth)",vitesse);
} else if (document.all) {
actu=setTimeout("moveAll
(div"+one+",div"+two+",'"+sens+"',vitesse,divWidth)",vitesse);
} else if (document.getElementById) {
actu=setTimeout("moveById(document.getElementById
('div"+one+"'),document.getElementById
('div"+two+"'),'"+sens+"',vitesse,divWidth)",vitesse);
}
return actu
}


function startscroll() {
if (document.layers) {
document.main.visibility='show'
document.main.document.layer1.left=1;
document.main.document.layer2.left=divWidth;
document.main.document.layer2.visibility='show';
actu=moveLayer
(document.main.document.layer1,document.main.document.layer2,sens,vitesse,divWidth);
} else if (document.all) {
document.all('div1').style.pixelLeft=1;
document.all('div2').style.pixelLeft=divWidth;
document.all('div2').style.visibility='visible';
actu=moveAll('div1','div2',sens,vitesse,divWidth);
} else if (document.getElementById) {
document.getElementById('div1').style.left=1+"px";
document.getElementById('div2').style.left=divWidth;
document.getElementById('div2').style.visibility='visible';
actu=moveById(document.getElementById('div1'),document.getElementById
('div2'),sens,vitesse,divWidth);
}
return actu
}
</script>
</head>
<body>
<script type="text/javascript">
if (document.layers) {
document.write("<table cellpadding=0 cellspacing=0 border=0 width="+eval(divWidth+30)
+"><tr><td><a ");
document.write("href=\"javascript:void(tourne('egal'))\"
class=\"turn\"><</a></td><td>");
document.write("<ilayer id=\"main\" width=460 height=28 top=0 left=0 bgcolor=9999cc
visibility=hide>");
document.write("<layer id=\"layer1\" top=0 left=1 width=460 onmouseover=\"stopmove()
\"   
onmouseout=\"startmove()\">");
document.write(messages[0]);
document.write("</layer>");
document.write("<layer id=\"layer2\" left=0 top=0 width=460 visibility=hide
onmouseover=\"stopmove()\"   onmouseout=\"startmove()\">");
document.write(messages[1])
document.write("</layer>");
document.write("</ilayer>");
document.write("</td><td><a ");
document.write("href=\"javascript:void(tourne('neg'))\"
class=\"turn\">></a></td></tr></table>");
} else {

document.write("<table cellpadding=0 cellspacing=0 border=0 width="+eval(divWidth+30)
+"><tr><td width=15>?</td><td width=15><a ");
document.write("href=\"javascript:void(tourne('egal'))\" 
class=\"turn\"><</a></td><td
width=460>");
document.write("<div id=\"monid\" >");
document.writeln("<div id=\"theid\"   >")
document.writeln("<div id=\"div1\"  onmouseover=\"stopmove()\" 
onmouseout=\"startmove()
\">")
if (document.all) { document.write(messages[0])
} else {
d = document.getElementById("div1");
chaine=eval("messages[0]");
textnodea = document.createTextNode(chaine);
d.appendChild(textnodea);
}
document.write("</div>")
document.writeln("<div id=\"div2\" onmouseover=\"stopmove()\"   
onmouseout=\"startmove()
\">")
if (document.all) { document.write(messages[1]);
}else {
d = document.getElementById("div2");
chaine=eval("messages[1]");
textnodec = document.createTextNode(chaine);
d.appendChild(textnodec);
}
document.write("</div>")
document.writeln("</div>")
document.write("</div>");
document.write("</td><td width=15><a ");
document.write("href=\"javascript:void(tourne('neg'))\" 
class=\"turn\">></a></td></tr></table>");

}
divok=1; //I use this divok to be sure that all the script is loaded before starting

sens='egal';    //  initializing direction sense
one=1           //this is the number of the first 'div' for the changing sense
if (document.layers) vitesse=30; else vitesse=10; // speed
if (divok==1) setTimeout('startscroll()',300);
/**************************************************************************
***********************
in this script you can put images in the scroller but be careful with the moveById
function,
you need to create element of type img
next setattribute('src','uri src') then appendchild etc.......
***************************************************************************
**********************/
  </script>
</body></html>




Builds JavaScript that updates the contents of one selector based on another.
Categories : HTML, Java Script, PHP, Complete Programs, General
Javascript Background Scroller
Categories : Java Script, CSS, HTML
How to create <SELECT> menues that change on the fly according to other <SELECT> menues on the page?
Categories : Java Script, HTML
Prevent Right Mouse steal your graphics
Categories : HTML, Java Script, Security
Cool tool tip
Categories : Java Script, HTML, Web Design
Conditional Check - a script that allows a user to submit a form only if the user check a checkbox.
Categories : HTML, Java Script, Form Processing, Beginner Guides
Javascript linked dropdowns
Categories : Java Script, HTML, Classes and Objects
Javascript animated menu items
Categories : DHTML, CSS, Java Script, HTML
Page Loading Message shown during the time your site's page is being loaded.
Categories : HTML, CSS, Java Script
complete simply working javascript password generator file. Use letter, vowels, consonants (uppercase and lowercase) arrays to create a really random and secure password. improved security using time functions to initialize random number generator.
Categories : Java Script, HTML, Security, Authentication, Strings
Bookmarklets are simple tools that extend the surf and search capabilities of Netscape and Explorer web browsers.
Categories : Java Script, HTML, General
How to get the Focus (Cursor) into a Form-Element.
Categories : HTML, Java Script
Show or Hide your Content using Javascript
Categories : Java Script, HTML, CSS, Beginner Guides
Higly Customizable Javascript Calendar Script
Categories : Java Script, Calendar, Date Time, HTML, CSS
Bouncing Marquee at Status Bar
Categories : Java Script, HTML, Browsers
 Neil McLeish wrote : 736
Would be fine if it actually worked.

However, after trawling through the code, I have decided to write my own as there is a distinct lack of programming discipline in this one - semi-colons seem to be scattered at random, code commenting with regard to configuration is noticable by its absence.

No disrespect to the coder, but Weberdev people, you should really check the stuff you post up here.
 
 Fred Horman wrote : 738
Didn`t work for me either. But The real problem isn`y the code but the window it`s posted into. After reading thru the code I noticed the website is wrapping the text. Thus causing the syntax to be incorrect. Listing the code is ok, but really there should have been a demo button on the page and a link to download the true code.
 
 alti mr wrote :739
there was a real problem with IE6 && NN6,
I`ve correct it and you can see the new code at 
http://alti.free.fr/test/marquee.htm

the author