Home > Javascript > Using Marquee

Using Marquee


Try this example to use Marquee with direction

Ex1:

<html>
<body>
<script language="JavaScript">
    function function1(){
        document.all.myMarquee.direction = "up";
    }
    function function2(){
        document.all.myMarquee.direction = "left";
    }
    function function3(){
        document.all.myMarquee.direction = "right";
    }
    function function4(){
        document.all.myMarquee.direction = "down";
    }
</script>
<marquee id="myMarquee" bgcolor="cyan">MARQUEE TEXT HERE</marquee>
<button onclick="function1();">Up</button>
<button onclick="function2();">Left</button>
<button onclick="function3();">Right</button>
<button onclick="function4();">Down</button>
</body>

Ex2 :

<html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>" >
<head runat="server">
    <title>.::M A R U Q U E E::. </title>
</head>
<body>
<script language="JavaScript">
    function goRightfor2sec()
    {
        document.getElementById('myMarquee').direction = "right";
    }
    function crawlLeft(){
        setTimeout(goRightfor2sec,2000);
        document.getElementById('myMarquee').direction = "left";
    }
    function crawlRight(){
        setTimeout(goLeftfor2sec,2000);
        document.getElementById('myMarquee').direction = "right";
    }
    function goLeftfor2sec(){
        document.getElementById('myMarquee').direction = "left";
    }
</script>
<button onclick="crawlLeft();">Left</button>
<marquee id="myMarquee"  bgcolor="cyan">MARQUEE TEXT HERE</marquee>
<button onclick="crawlRight();">Right</button>
</body>
</html>

Good Luck

Advertisements
Categories: Javascript
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: