Log in

View Full Version : Random Javascript Script Problem



benslayton
07-06-2006, 04:35 PM
Im using this script:


<script>

var contents_b=new Array()

//1) Specify content(s) to display and rotate (extend as desired)
contents_b[0]='<img border="0" src="images/pies.gif"><img src="/images/1arrow.gif" width="3" height="6" align="absmiddle"> <font>Pies</font>'
contents_b[1]='<img border="0" src="images/breads.gif"><img src="/images/1arrow.gif" width="3" height="6" align="absmiddle"> <font>Breads</font>'
contents_b[2]='<img border="0" src="images/cakes.gif"><img src="/images/1arrow.gif" width="3" height="6" align="absmiddle"> <font>Cakes</font>'

var the_one_b
var y=0
var spacing_b=" "

while (y<contents_b.length){
the_one_b=Math.floor(Math.random()*contents_b.length)
if (contents_b[the_one_b]!="_selected!"){
document.write(contents_b[the_one_b]+spacing_b)
contents_b[the_one_b]="_selected!"
y++
}
}

</script>


and I need the arrow & text to be under the picture.

Page with the problem (http://www.cakesbypat.net/test2.htm)

BLiZZaRD
07-06-2006, 05:03 PM
I am by no means a JS person.. but I was able to get close, only thing is that the whole thing is down left side, instead of across the top:



<script>

var contents_b=new Array()


contents_b[0]='<p><img border="0" src="images/pies.gif"><br><img src="/images/1arrow.gif" width="3" height="6" align="absmiddle"> <font>Pies</font></p>'

contents_b[1]='<p><img border="0" src="images/breads.gif"><br><img src="/images/1arrow.gif" width="3" height="6" align="absmiddle"> <font>Breads</font></p>'

contents_b[2]='<p><img border="0" src="images/cakes.gif"><br><img src="/images/1arrow.gif" width="3" height="6" align="absmiddle"> <font>Cakes</font></p>'

var the_one_b
var y=0
var spacing_b=" "

while (y<contents_b.length){
the_one_b=Math.floor(Math.random()*contents_b.length)
if (contents_b[the_one_b]!="_selected!"){
document.write(contents_b[the_one_b]+spacing_b)
contents_b[the_one_b]="_selected!"
y++
}
}

</script>

benslayton
07-06-2006, 05:41 PM
well I need the pictures side by side and the text under it.