0

here is my code. this is working fine but small prblm is here.fading text is working only one time. it is not working multiple times. can anybody check what is the prblm is der? rotation not working.just copy paste this codeand see what is the prblm is there.first time loop is rotating but second time "undefined" comming.

<?php
ob_start();
extract($_REQUEST);
extract($_POST);
session_start();
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
$db=mysql_select_db('murali',$con);
?>
<!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=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
<!-- Paste this code into an external JavaScript file named: marquee.js  -->

/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Mike Hudson :: http://www.afrozeus.com */

function setupFadeLinks() {
<? 
$i=0;
$select=mysql_query("select * from registration where status=1");
while($fetch=mysql_fetch_array($select))
{
?>

arrFadeTitles[<?=$i?>]='<?=$fetch[email]?>';
arrFadeTitles1[<?=$i?>]='<?=$fetch[username]?>';
<?
$i++;
}
?>
  
}

// You can also play with these variables to control fade speed, fade color, and how fast the colors jump.

var m_FadeOut = 255;
var m_FadeIn=0;
var m_Fade = 0;
var m_FadeStep = 3;
var m_FadeWait = 1600;
var m_bFadeOut = true;

var m_iFadeInterval;

window.onload = Fadewl;

var arrFadeTitles;
var arrFadeTitles1;
var arrFadeCursor = 0;
var arrFadeMax;

function Fadewl() {
  m_iFadeInterval = setInterval(fade_ontimer, 10);
  
  arrFadeTitles = new Array();
   arrFadeTitles1 = new Array();
  setupFadeLinks();
 
  setFadeLink();
}

function setFadeLink() {
  var ilink = document.getElementById("fade_link");
  ilink.innerHTML = arrFadeTitles[arrFadeCursor];
  var jlink = document.getElementById("fade_link1");
  jlink.innerHTML = arrFadeTitles1[arrFadeCursor];
}

function fade_ontimer() {
  if (m_bFadeOut) {
    m_Fade+=m_FadeStep;
    if (m_Fade>m_FadeOut) {
      arrFadeCursor++;
      if (arrFadeCursor>arrFadeMax)
        arrFadeCursor=0;
      setFadeLink();
      m_bFadeOut = false;
    }
  } else {
    m_Fade-=m_FadeStep;
    if (m_Fade<m_FadeIn) {
      clearInterval(m_iFadeInterval);
      setTimeout(Faderesume, m_FadeWait);
      m_bFadeOut=true;
    }
  }
  var ilink = document.getElementById("fade_link");
  if ((m_Fade<m_FadeOut)&&(m_Fade>m_FadeIn))
    ilink.style.color = "#" + ToHex(m_Fade);
	 var ilink = document.getElementById("fade_link1");
  if ((m_Fade<m_FadeOut)&&(m_Fade>m_FadeIn))
    jlink.style.color = "#" + ToHex(m_Fade);
}

function Faderesume() {
  m_iFadeInterval = setInterval(fade_ontimer, 10);
}

function ToHex(strValue) {
  try {
    var result= (parseInt(strValue).toString(16));

    while (result.length !=2)
            result= ("0" +result);
    result = result + result + result;
    return result.toUpperCase();
  }
  catch(e)
  {
  }
}
</script>
</head>

<body>
<div id="fade_base" style="width:250px;padding:5px;height:60px;line-height:1.8em;">

<strong><em><lable id="fade_link"></lable>
<lable id="fade_link1"></lable>
</em></strong>
</div>
</body>
</html>

Edited by muralikalpana: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by pushpakalpana
0

try this

<?php
ob_start();
extract($_REQUEST);
extract($_POST);
session_start();
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
$db=mysql_select_db('dbname',$con);
?>
<html>

<body>

<script type="text/javascript">

/***********************************************
* Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var delay = 3000; //set delay between message change (in miliseconds)
var maxsteps=30; // number of steps to take to change from start color to endcolor
var stepdelay=90; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(255,255,255); // start color (red, green, blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)

var fcontent=new Array();
begintag='<div style="font: normal 25px Arial; padding: 5px; color: red">'; //set opening tag, such as font declarations
<? 
$i=0;
$select=mysql_query("select email from registration");
while($fetch=mysql_fetch_array($select))
{
?>

fcontent[<?=$i?>]='<?=$fetch[email]?>';
<?
$i++;
}
?>
//fcontent[1]="Dynamic Drive has been featured on Jars as a top 5% resource, and About.com as a recommended DHTML destination.";
//fcontent[2]="Ok, enough with these pointless messages. You get the idea behind this script.</a>";
closetag='</div>';

var fwidth='150px'; //set scroller width
var fheight='150px'; //set scroller height

var fadelinks=1; //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////


var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;


/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
if (index>=fcontent.length)
index=0
if (DOM2){
document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
if (fadelinks)
linkcolorchange(1);
colorfade(1, 15);
}
else if (ie4)
document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
index++
}

// colorfade() partially by Marcio Galli for Netscape Communications. ////////////
// Modified by Dynamicdrive.com

function linkcolorchange(step){
var obj=document.getElementById("fscroller").getElementsByTagName("A");
if (obj.length>0){
for (i=0;i<obj.length;i++)
obj[i].style.color=getstepcolor(step);
}
}

/*Rafael Raposo edited function*/
var fadecounter;
function colorfade(step) {
if(step<=maxsteps) {
document.getElementById("fscroller").style.color=getstepcolor(step);
if (fadelinks)
linkcolorchange(step);
step++;
fadecounter=setTimeout("colorfade("+step+")",stepdelay);
}else{
clearTimeout(fadecounter);
document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
setTimeout("changecontent()", delay);

}
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
var diff
var newcolor=new Array(3);
for(var i=0;i<3;i++) {
diff = (startcolor[i]-endcolor[i]);
if(diff > 0) {
newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
} else {
newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
}
}
return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (ie4||DOM2)
document.write('<div id="fscroller" style=width:'+fwidth+';height:'+fheight+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent

</script>

</body>
</html>
1
<?php
ob_start();
extract($_REQUEST);
extract($_POST);
session_start();
$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
$db=mysql_select_db('dbname',$con);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>Transition</title>
    <style type="text/css">
      div.rotator { position: relative; height: 100px; width: 200px; padding: 10px;}
      
      div.r1 p { margin-top: 20px; text-align: center; }
       

    </style>
    <script type="text/javascript" src="./jquery.1.3.2-min.js"></script>
    <script type="text/javascript">
      (function ($) {
        $.fn.fadeTransition = function(options) {
          var options = $.extend({pauseTime: 5000, transitionTime: 2000}, options);
          var transitionObject;

          Trans = function(obj) {
            var timer = null;
            var current = 0;
            var els = $("> *", obj).css("display", "none").css("left", "0").css("top", "0").css("position", "absolute");
            $(obj).css("position", "relative");
            $(els[current]).css("display", "block");

            function transition(next) {
              $(els[current]).fadeOut(options.transitionTime);
              $(els[next]).fadeIn(options.transitionTime);
              current = next;
              cue();
            };

            function cue() {
              if ($("> *", obj).length < 2) return false;
              if (timer) clearTimeout(timer);
              timer = setTimeout(function() { transition((current + 1) % els.length | 0)} , options.pauseTime);
            };
            
            this.showItem = function(item) {
              if (timer) clearTimeout(timer);
              transition(item);
            };

            cue();
          }

          this.showItem = function(item) {
            transitionObject.showItem(item);
          };

          return this.each(function() {
            transitionObject = new Trans(this);
          });
        }

      })(jQuery);
    
      var page = {
        tr: null,
        init: function() {
          page.tr = $(".area").fadeTransition({pauseTime: 7000, transitionTime: 2000});
          $("div.navigation").each(function() {
            $(this).children().each( function(idx) {
              if ($(this).is("a"))
                $(this).click(function() { page.tr.showItem(idx); })
            });
          });
        },

        show: function(idx) {
          if (page.tr.timer) clearTimeout(page.tr.timer);
          page.tr.showItem(idx);
        }
      };

      $(document).ready(page.init);    
    </script>
  </head>
  
  <body><div class="area">
  <? 

$select=mysql_query("select * from registration");
while($fetch=mysql_fetch_array($select))
{
?>



    
      <div class="rotator r1">
        
        <p><?=$fetch[email]?></p>
		 <p><?=$fetch[username]?></p>
      </div>
	  <?

}
?> </div>
     <!-- <div class="rotator r2">
        <div class="navigation">
          <a href="#">&nbsp;</a>
          <div class="current"></div>
          <a href="#">&nbsp;</a>
          <a href="#">&nbsp;</a>
        </div>
        <img src="http://www.google.com.au/intl/en_au/images/logo.gif" alt="Google's Logo" />
      </div>
      <div class="rotator r3">
        <div class="navigation">
          <a href="#">&nbsp;</a>
          <a href="#">&nbsp;</a>
          <div class="current"></div>
          <a href="#">&nbsp;</a>
        </div>
        <ul>
          <li>This</li>
          <li>box</li>
          <li>contains</li>
          <li>an</li>
          <li>unordered</li>
          <li>list</li>
        </ul>
      </div>
      <div class="rotator r4">
        <div class="navigation">
          <a href="#">&nbsp;</a>
          <a href="#">&nbsp;</a>
          <a href="#">&nbsp;</a>
          <div class="current"></div>
        </div>
        <img src="./turkey.jpg" alt="Bush Turkey" />
      </div>-->
   
  </body>
</html>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.