Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: marquee problem

  1. #1
    New Coder
    Join Date
    Sep 2009
    Posts
    30
    Thanks
    2
    Thanked 0 Times in 0 Posts

    marquee problem

    I want to show marquee on my page but when I write the code it doesn't give me any error.I want to show the title in marquee can any one help me to solve this problem.
    Thanks in advance
    marquee.php
    PHP Code:

    <script language=javascript>
    var scroll1 = new scrollObject('scr1', 250, 16,  'left', 2000, 1.3);
    var scroll2 = new scrollObject('scr2', 250, 135, 'right', 2000, 1.3);
    var scroll3 = new scrollObject('scr3', 250, 24, 'up', 4000, 1.3);
    <?php
        $sql
    ="select *  from contents WHERE content_type=1 LIMIT 5";
        
    $recordSet = &$conn->Execute($sql);
        
    $counter=0;
        while (!
    $recordSet->EOF) {
                echo 
    "scroll1.block[$counter]='".$recordSet->fields[1]."';";
                echo 
    "scroll2.block[$counter]='".$recordSet->fields[1]."<br><hr>".$recordSet->fields[2]."';";
                
    $recordSet->MoveNext();
                
    $counter++;

        }
        
        
    $sql="select *  from adv ";
        
    $recordSet = &$conn->Execute($sql);
        
    $counter=0;
        while (!
    $recordSet->EOF) {
                echo 
    "scroll3.block[$counter]='&nbsp;<img src=images/title_$lang.gif align=absmiddle>&nbsp;&nbsp;<a href=adv.php?adv_id=".$recordSet->fields[0].">".$recordSet->fields[1]."</a>';";
                
    $recordSet->MoveNext();
                
    $counter++;

        }
    ?>

     function scrollObject(main, width, height, direct, pause, speed) {
      var self = this;
      this.main = main;
      this.width = width;
      this.height = height;
      this.direct = direct;
      this.pause = pause;
      this.speed = Math.max(1.001, Math.min((direct == "up" || direct == "down") ? height : width, speed));
      this.block = new Array();
      this.blockprev = this.offset = 0;
      this.blockcurr = 1;
      this.mouse = false;
      this.scroll = function() {
        if (!document.getElementById) return false;
        this.main = document.getElementById(this.main);
        while (this.main.firstChild) this.main.removeChild(this.main.firstChild);
        this.main.style.overflow = "hidden";
        this.main.style.position = "relative";
        this.main.style.width = this.width + "px";
        this.main.style.height = this.height + "px";
        for (var x = 0; x < this.block.length; x++) {
          var table = document.createElement('table');
              table.cellPadding = table.cellSpacing = table.border = "0";
              table.style.position = "absolute";
              table.style.left = table.style.top = "0px";
              table.style.width = this.width + "px";
              table.style.height = this.height + "px";
              table.style.overflow = table.style.visibility = "hidden";
            var tbody = document.createElement('tbody');
              var tr = document.createElement('tr');
                var td = document.createElement('td');
                    td.innerHTML = this.block[x];
                  tr.appendChild(td);
                tbody.appendChild(tr);
              table.appendChild(tbody);
          this.main.appendChild(this.block[x] = table);
        }
        if (this.block.length > 1) {
          this.main.onmouseover = function() { self.mouse = true; }
          this.main.onmouseout = function() { self.mouse = false; }
          setInterval(function() {
            if (!self.offset && self.scrollLoop()) self.block[self.blockcurr].style.visibility = "visible";
          }, this.pause);
        } this.block[this.blockprev].style.visibility = "visible";
      }
      this.scrollLoop = function() {
        if (!this.offset) {
          if (this.mouse) return false;
          this.offset = (this.direct == "up" || this.direct == "down") ? this.height : this.width;
        } else this.offset = Math.floor(this.offset / this.speed);
        if (this.direct == "up" || this.direct == "down") {
          this.block[this.blockcurr].style.top = ((this.direct == "up") ? this.offset : -this.offset) + "px";
          this.block[this.blockprev].style.top = ((this.direct == "up") ? this.offset - this.height : this.height - this.offset) + "px";
        } else {
          this.block[this.blockcurr].style.left = ((this.direct == "left") ? this.offset : -this.offset) + "px";
          this.block[this.blockprev].style.left = ((this.direct == "left") ? this.offset - this.width : this.width - this.offset) + "px";
        }
        if (!this.offset) {
          this.block[this.blockprev].style.visibility = "hidden";
          this.blockprev = this.blockcurr;
          if (++this.blockcurr >= this.block.length) this.blockcurr = 0;
        } else setTimeout(function() { self.scrollLoop(); }, 30);
        return true;
      }
    }
    </script>

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    you haven't said what the issue is, just
    PHP Code:
    but when I write the code it doesnt give me any error 
    which doesn't make much sense. if the actual fields from your query are being displayed, than this is a javascript question.

  • #3
    New Coder
    Join Date
    Sep 2009
    Posts
    30
    Thanks
    2
    Thanked 0 Times in 0 Posts

    marquee

    Sorry, I want to show my database in marquee using javascript & php. I use echo to print the database sql in the page but doesn't print any thing.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •