1

hello...
i want to do "images and text" which is in database...that content fetch in user's side....but sliding problem occuring...for example i have 5 images and 5 descriptions is der..so i want to show image[1],description[1] after some milliseconds image[2],description[2] .....etc
like this...but all images are displaying once..that is my problem.. anybody plz look at this............below given my problem...in that which code i put in comments that is working but when i am retriving from database that s nt working.....actually i wrote individual javascript for(description and images) scroller effects.

<html>
<head>
<script language="JavaScript1.2">
function reapply(){
setTimeout("slideit()",7000)
return true
}
window.onerror=reapply
</script>
<script language="JavaScript1.1">
<!--
<? $select=mysql_query("select * from successstory where status=1");
$num=mysql_num_rows($select);
$i=0;
while($fetch=mysql_fetch_array($select)){
if($i<$num)
{
?>

var image[]=new Image()
alert('<? echo $i; ?>' );
image.src="successphotos/<? echo $fetch['photo'];?>"

/*var image1=new Image()
image1.src="userphotos/x.jpg"
var image2=new Image()
image2.src="userphotos/v.jpg"
var image3=new Image()
image3.src="userphotos/b.jpg"*/
//-->
<? $i++; } }?>
//-->
</script>
</head>
<body>
<div class="ss_storiesbox">
<? $select=mysql_query("select * from successstory where status=1");
$num=mysql_num_rows($select);
$i=0;
while($fetch=mysql_fetch_array($select)){
if($i<$num)
{
echo $i;
?><script type="text/javascript">
var delay = 1600; //set delay between message change (in miliseconds)
var maxsteps=30; // number of steps to take to change from start color to endcolor
var stepdelay=40; // 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 14px Arial; padding: 5px;">'; //set opening tag, such as font declarations
fcontent['<? echo $i; ?>']='<? echo $fetch[description] ?> '
/*fcontent[0]="<b>murali Weads ****</b><br>No doubt, Meresathi.com is a good website. Well, we seriously thinking about the marriage. We both were searching...            <a href=Readmore.php>Readmore</a>....<br><br>";
fcontent[1]="<b>xxxx Weads xxxx</b><br>it was frm the 1<sup>st</sup> time i saw her profile i decided to initiate. By grace of GOD everything moved smoothly and positively ahead..            <a href=Readmore.php>Readmore</a>....<br>";
fcontent[2]="<b>yyyy Weads yyyy</b><br>arriages Are made in heaven but still you need a medium for communication between two souls.Jeevansathi....       <a href=Readmore.php>Readmore</a>....<br>";
*/closetag='</div>';

var fwidth='250px'; //set scroller width
var fheight='100px'; //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;



//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);
}
}


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);

}
}


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="border:1px solid black;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></div>
<div class="imgbox_ss">

<a href="/forums/javascript:slidelink()" onMouseover="window.status='Click on the image to learn more about it!';return true" onMouseout="window.status=''"><img src="successphotos/<? echo $fetch['photo'];?>" name="slide" width="101" height="101" border=0 style="filter:blendTrans(duration=3)"/></a>

<script>
<!--
////change number of images below
var number_of_images='<? echo $num; ?>'
//change speed below (in seconds)
var speed=3
var step=1
var whichimage=1
function slideit(){
if (!document.images)
return
if (document.all)
slide.filters.blendTrans.apply()
document.images.slide.src=eval("image"+step+".src")
if (document.all)
slide.filters.blendTrans.play()
whichimage=step
if (step<number_of_images)
step++
else
step=1
if (document.all)
setTimeout("slideit()",speed*1000+1000)
else
setTimeout("slideit()",speed*1000)
}
function slidelink(){
if (whichimage=='<?=$num?>')
window.location="index.php"
/*else if (whichimage==2)
window.location="index.php"
else if (whichimage==3)
window.location="index.php"*/
}
//-->
</script>
<? $i++;
}
}
?>
</div>
</div>

</div>

</body>
</html>

Edited by peter_budo: Not a code snipped. Transfering to forum thread

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by pushpakalpana
This topic has been dead for over six months. 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.