Miette
05-30-2003, 10:53 AM
hi, I found in this forum a code to get random pics. The thing is that I want the pic to be centered. What do I have to do? I know it may be a stupid question, but I'm still new in this :P
Here's the code, in case it helps:
<script language="javascript">
//Created and Copywright Daniel Marcus 2002. I give permission to all non-profitable organisations to use this script as long as they keep my name in it!
//IMPORANT:Always program 1 more of the if statements than you need. Why?? Because there is around 1/1000000 chance that this will be it!
//change this number below to set the number of options you want to have! unless you add more if statements this is limited to 20!
var Num = 15
var No = Math.random() * 100
No = Math.round(No)
var numNo = 100/Num
//below, all you have to do is change the page locations
if(No<=numNo) {
pgHi = "random3.jpg"
}
if(No>numNo && No<numNo*2) {
pgHi = "random7.jpg"
}
if(No>=numNo*2 && No<numNo*3) {
pgHi = "random17.jpg"
}
if(No>=numNo*3 && No<numNo*4) {
pgHi = "random19.jpg"
}
if(No>=numNo*4 && No<numNo*5) {
pgHi = "random62.jpg"
}
document.write('<img src="'+pgHi+'">')
</script>
Do I have to place the <center> tags somewhere? Thanks!
Here's the code, in case it helps:
<script language="javascript">
//Created and Copywright Daniel Marcus 2002. I give permission to all non-profitable organisations to use this script as long as they keep my name in it!
//IMPORANT:Always program 1 more of the if statements than you need. Why?? Because there is around 1/1000000 chance that this will be it!
//change this number below to set the number of options you want to have! unless you add more if statements this is limited to 20!
var Num = 15
var No = Math.random() * 100
No = Math.round(No)
var numNo = 100/Num
//below, all you have to do is change the page locations
if(No<=numNo) {
pgHi = "random3.jpg"
}
if(No>numNo && No<numNo*2) {
pgHi = "random7.jpg"
}
if(No>=numNo*2 && No<numNo*3) {
pgHi = "random17.jpg"
}
if(No>=numNo*3 && No<numNo*4) {
pgHi = "random19.jpg"
}
if(No>=numNo*4 && No<numNo*5) {
pgHi = "random62.jpg"
}
document.write('<img src="'+pgHi+'">')
</script>
Do I have to place the <center> tags somewhere? Thanks!