TinyPortal

Development => Block Codes => Topic started by: Mitchâ„¢ on April 11, 2006, 11:34:21 PM

Title: A Random Picture/Banner Script
Post by: Mitchâ„¢ on April 11, 2006, 11:34:21 PM
WHAT:
A Random Picture/Banner Script


WHY:
Well I was looking for something like this but I couldnt find it.
So well I googled it. I like this one the best I did a lil bit of editing to it tidied it up.
There was no copyright that went with this so I am guessing it is ok to post it here.


WHERE:
http://www.crowes.f9.co.uk/Javascript/test.htm (http://www.crowes.f9.co.uk/Javascript/test.htm)



<center>
<SCRIPT LANGUAGE="Javascript">
function banner() {} ; b = new banner() ; n = 0
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
i=Math.floor(Math.random() * n) ;
document.write( b[i] )
</SCRIPT>
</center>

Title: Re: A Random Picture/Banner Scrip
Post by: PokerOwnage on April 11, 2006, 11:39:24 PM
nice one mitch!  i know nuke has this built into their portal system... where its easy to just go into admin and add banners and text etc etc... i hope/wonder if this is possible with smf, cause i know others at my site dont know how to edit code really haha
Title: Re: A Random Picture/Banner Scrip
Post by: Mitchâ„¢ on April 11, 2006, 11:45:47 PM
Quote from: PokerOwnage on April 11, 2006, 11:39:24 PM
i hope/wonder if this is possible with smf, cause i know others at my site dont know how to edit code really haha

I am sure it would be possible. Over my head though. The editing of this is just pretty straight forward I thought.
Title: Re: A Random Picture/Banner Script
Post by: PokerOwnage on April 11, 2006, 11:49:59 PM
yea... i do websites for people who hardly know how to browse the web haha
Title: Re: A Random Picture/Banner Script
Post by: G6Cad on April 12, 2006, 02:39:23 PM
Nice Mitch :)
I have it all set up on my portal so now i can show my aqvarel art there to :)
Title: Re: A Random Picture/Banner Script
Post by: atomz on April 12, 2006, 02:40:33 PM
nicee
Title: Re: A Random Picture/Banner Script
Post by: Mitchâ„¢ on April 12, 2006, 03:09:40 PM
Yay I am glad that I was helpful.
Title: Re: A Random Picture/Banner Script
Post by: elpvn on April 12, 2006, 03:17:00 PM
It's nice for set as a dinamic logo but I like it get the pictures from a gallery than rather :)

Quote from: SlideShowScript<SCRIPT LANGUAGE="JavaScript"><!--

var slideShowSpeed = 2000;
var fadeDuration = 3;

fadeimgarray = new Array();
fadeimgarray[0] = 'images/1.jpg';
fadeimgarray[1] = 'images/2.jpg';
fadeimgarray[2] = 'images/3.jpg';
fadeimgarray[3] = 'images/4.jpg';

var t
var j = 0

var preLoad = new Array()
for (i = 0; i < fadeimgarray.length; i++){
   preLoad = new Image()
   preLoad.src = fadeimgarray
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=fadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()     
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (fadeimgarray.length-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
//--></SCRIPT>

<BODY BGCOLOR="#FFFFFF" onLoad="runSlideShow()">

<IMG SRC="images/1.jpg" NAME="SlideShow" BORDER=0>

Demo here: http://www.crowes.f9.co.uk/Javascript/slideshow.htm ;)
Title: Re: A Random Picture/Banner Script
Post by: Mitchâ„¢ on April 12, 2006, 03:47:40 PM
Quote from: elpvn on April 12, 2006, 03:17:00 PM
It's nice for set as a dinamic logo but I like it get the pictures from a gallery than rather :)

Quote from: SlideShowScript<SCRIPT LANGUAGE="JavaScript"><!--

var slideShowSpeed = 2000;
var fadeDuration = 3;

fadeimgarray = new Array();
fadeimgarray[0] = 'images/1.jpg';
fadeimgarray[1] = 'images/2.jpg';
fadeimgarray[2] = 'images/3.jpg';
fadeimgarray[3] = 'images/4.jpg';

var t
var j = 0

var preLoad = new Array()
for (i = 0; i < fadeimgarray.length; i++){
   preLoad = new Image()
   preLoad.src = fadeimgarray
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=fadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()     
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (fadeimgarray.length-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
//--></SCRIPT>

<BODY BGCOLOR="#FFFFFF" onLoad="runSlideShow()">

<IMG SRC="images/1.jpg" NAME="SlideShow" BORDER=0>

Demo here: http://www.crowes.f9.co.uk/Javascript/slideshow.htm ;)


umm I thought I tired that one but it didnt work with larger images or maybe it was just me.

But I like this one cause it loads a different one on each page load which I needed since I am using it for ads/sponsers.
Title: Re: A Random Picture/Banner Script
Post by: MADxMAX on April 14, 2006, 03:49:52 PM
if i try to use this i get an error,i think i got it the right way rounnd for the image location and the link,but any help or advice would be nice thnx


Parse error: syntax error, unexpected '<' in /home/madmax/public_html/forums/Sources/Load.php(1623) : eval()'d code(34) : eval()'d code on line 1
[/code
Title: Re: A Random Picture/Banner Script
Post by: G6Cad on April 14, 2006, 04:35:15 PM
Mitch script shouldent give a parse error like that.

Have you copyed the code from the first post and put it in a script Block? Or have you used the code from Elvpn ?

Title: Re: A Random Picture/Banner Script
Post by: MADxMAX on April 14, 2006, 06:25:15 PM
i copied the code from the 1st post,put it into a php block,enterd what i think is the right information for the image ( banner ) and the link when its clicked on,which is the best code to use,id love to have this feature on my site,but for the life of me i cant get it to work HELP!
Title: Re: A Random Picture/Banner Script
Post by: G6Cad on April 14, 2006, 07:39:24 PM
You cant use it in a PHP Block, you need that code in a script Block, itÂÃ,´s a java script code :)

Try change the Block to Script, instead of a PHP and you will have it the way you want :)
Title: Re: A Random Picture/Banner Script
Post by: Mitchâ„¢ on April 14, 2006, 09:18:34 PM
Well which one are you are using first off. Because there are two different scripts here. The one that I originally and then the one someone tried to say was better.
Title: Re: A Random Picture/Banner Script
Post by: MADxMAX on April 14, 2006, 09:55:14 PM
Quote from: Mitchâââ,¬Å¾Ã,¢ on April 14, 2006, 09:18:34 PM
Well which one are you are using first off. Because there are two different scripts here. The one that I originally and then the one someone tried to say was better.

i used yours Mitchâââ,¬Å¾Ã,¢,as stated in the reply above i used the 1st code that was posted
Title: Re: A Random Picture/Banner Script
Post by: Mitchâ„¢ on April 14, 2006, 11:09:05 PM
Quote from: G6 on April 14, 2006, 07:39:24 PM
You cant use it in a PHP Block, you need that code in a script Block, itÂÃ,´s a java script code :)

Try change the Block to Script, instead of a PHP and you will have it the way you want :)

That should work.
Title: Re: A Random Picture/Banner Script
Post by: MADxMAX on April 15, 2006, 01:05:20 PM
thanks every1 for your help and advice,i've finally got it working,but i still have 1 more questions,the images are to the left is there anyway to center them,ive got them in a centre block ( my site www.itforfree.net )personnaly i think they would look better if they was in the middle of the centre block,again any help or advice would be great,and its mitch's code im using on TP with SMF1.1RC2

thnx for the help

:)
Title: Re: A Random Picture/Banner Script
Post by: Mitchâ„¢ on April 15, 2006, 03:12:37 PM
Quote from: MADxMAX on April 15, 2006, 01:05:20 PM
thanks every1 for your help and advice,i've finally got it working,but i still have 1 more questions,the images are to the left is there anyway to center them,ive got them in a centre block ( my site www.itforfree.net )personnaly i think they would look better if they was in the middle of the centre block,again any help or advice would be great,and its mitch's code im using on TP with SMF1.1RC2

thnx for the help

:)


Did you copy the <center> </center> tags?
If so I do not really know what to tell you.
Post the script here.
Title: Re: A Random Picture/Banner Script
Post by: MADxMAX on April 15, 2006, 04:02:11 PM
Quote from: Mitchâââ,¬Å¾Ã,¢ on April 15, 2006, 03:12:37 PM
Quote from: MADxMAX on April 15, 2006, 01:05:20 PM
thanks every1 for your help and advice,i've finally got it working,but i still have 1 more questions,the images are to the left is there anyway to center them,ive got them in a centre block ( my site www.itforfree.net )personnaly i think they would look better if they was in the middle of the centre block,again any help or advice would be great,and its mitch's code im using on TP with SMF1.1RC2

thnx for the help

:)


Did you copy the <center> </center> tags?
If so I do not really know what to tell you.
Post the script here.

oooooooops musta left that bit out,im new to code etc so easy mistake to make,thnx for all your help mitch :)
Title: Re: A Random Picture/Banner Script
Post by: Mitchâ„¢ on April 15, 2006, 04:03:28 PM
Oh no problem. I was just really confused there for a second. :D
Title: Re: A Random Picture/Banner Script
Post by: MADxMAX on April 15, 2006, 09:19:38 PM
Quote from: Mitchâââ,¬Å¾Ã,¢ on April 15, 2006, 04:03:28 PM
Oh no problem. I was just really confused there for a second. :D

welcome to my world,im always confused
Title: Re: A Random Picture/Banner Script
Post by: elpvn on April 16, 2006, 06:06:11 AM
Quote from: G6 on April 14, 2006, 04:35:15 PM
Mitch script shouldent give a parse error like that.

Have you copyed the code from the first post and put it in a script Block? Or have you used the code from Elvpn ?



Not at all, though two codes has same feature, G6 !
To Mitchâââ,¬Å¾Ã,¢ : Thank, are u an art designer ?  ;)
Title: Re: A Random Picture/Banner Script
Post by: Mitchâ„¢ on April 16, 2006, 06:08:35 AM
Quote from: elpvn on April 16, 2006, 06:06:11 AM
Quote from: G6 on April 14, 2006, 04:35:15 PM
Mitch script shouldent give a parse error like that.

Have you copyed the code from the first post and put it in a script Block? Or have you used the code from Elvpn ?



Not at all, though two codes has same feature, G6 !
To Mitchâââ,¬Å¾Ã,¢ : Thank, are u an art designer ?  ;)

Eh more along the lines of an art editor.
I edit things alot more then I create.
Title: Re: A Random Picture/Banner Script
Post by: sdl on April 18, 2006, 08:06:13 AM
There is another way. Very easy, very cool. I use it for random images for each time a page is loaded. Good for avatars, banners, anything at all.  Look at the following pic. Each time you refresh this page should see a different image.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fexamples.com%2Favatar%2Fimage.jpg&hash=b3a1c7573da0ea5751f8e715ad8507db93fea973)

I found that with a small code modification, it works equally well with flash files.
I learned how to do it here.  (http://www.osix.net/modules/article/?id=657)
(be sure to read all the comments that follow the post in this link)

Enjoy!
Title: Re: A Random Picture/Banner Script
Post by: elpvn on April 18, 2006, 09:40:17 AM
Thanks for code, sdl
I'm very happy when knew that, Mitchâââ,¬Å¾Ã,¢  ;D
Title: Re: A Random Picture/Banner Script
Post by: sdl on April 18, 2006, 01:44:14 PM
Hey no problem! I also show how to do the same with Flash objects (clocks, in this case) on a new SMF experimental site that I set up.

http://smf.examples.com

Check it out!
Title: Re: A Random Picture/Banner Script
Post by: technodragon73 on April 21, 2006, 04:34:18 PM
Quote from: Mitchâââ,¬Å¾Ã,¢ on April 11, 2006, 11:34:21 PM
WHAT:
A Random Picture/Banner Script


WHY:
Well I was looking for something like this but I couldnt find it.
So well I googled it. I like this one the best I did a lil bit of editing to it tidied it up.
There was no copyright that went with this so I am guessing it is ok to post it here.


WHERE:
http://www.crowes.f9.co.uk/Javascript/test.htm (http://www.crowes.f9.co.uk/Javascript/test.htm)



<center>
<SCRIPT LANGUAGE="Javascript">
function banner() {} ; b = new banner() ; n = 0
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
i=Math.floor(Math.random() * n) ;
document.write( b[i] )
</SCRIPT>
</center>



Is there anyway to do this, but have it pull a link from a database at random?
Title: Re: A Random Picture/Banner Script
Post by: copter on May 02, 2006, 03:13:49 AM
Thanks Mitch! the code was very easy to use :)
Title: Re: A Random Picture/Banner Script
Post by: Uthn on May 02, 2006, 01:47:28 PM
Quote from: sdl on April 18, 2006, 08:06:13 AM
There is another way. Very easy, very cool. I use it for random images for each time a page is loaded. Good for avatars, banners, anything at all.  Look at the following pic. Each time you refresh this page should see a different image.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fexamples.com%2Favatar%2Fimage.jpg&hash=b3a1c7573da0ea5751f8e715ad8507db93fea973)


I found that with a small code modification, it works equally well with flash files.
I learned how to do it here.  (http://www.osix.net/modules/article/?id=657)
(be sure to read all the comments that follow the post in this link)

Enjoy!

Hi there,

Thanks for the code, works fine on my local version of TP BUT i can't get it to work on my public site (it just displays an empty block, no image)

I think it's related to read rights (i can't change them via chmod on my hosting), any hint ?

thanks
Title: Re: A Random Picture/Banner Script
Post by: technodragon73 on May 02, 2006, 02:15:36 PM
Quote from: sdl on April 18, 2006, 08:06:13 AM
There is another way. Very easy, very cool. I use it for random images for each time a page is loaded. Good for avatars, banners, anything at all.  Look at the following pic. Each time you refresh this page should see a different image.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fexamples.com%2Favatar%2Fimage.jpg&hash=b3a1c7573da0ea5751f8e715ad8507db93fea973)

I found that with a small code modification, it works equally well with flash files.
I learned how to do it here.  (http://www.osix.net/modules/article/?id=657)
(be sure to read all the comments that follow the post in this link)

Enjoy!

Works fine, but is there a way to add a hyperlink to it?
Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 02, 2006, 06:25:01 PM
Quote from: copter on May 02, 2006, 03:13:49 AM
Thanks Mitch! the code was very easy to use :)

Very cool, code works good.   8)
Title: Re: A Random Picture/Banner Script
Post by: sdl on May 02, 2006, 06:31:45 PM
Quote from: TechnoDragon on May 02, 2006, 02:15:36 PM
Quote from: sdl on April 18, 2006, 08:06:13 AM
There is another way. Very easy, very cool. I use it for random images for each time a page is loaded. Good for avatars, banners, anything at all.  Look at the following pic. Each time you refresh this page should see a different image.

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fexamples.com%2Favatar%2Fimage.jpg&hash=b3a1c7573da0ea5751f8e715ad8507db93fea973)

I found that with a small code modification, it works equally well with flash files.
I learned how to do it here.  (http://www.osix.net/modules/article/?id=657)
(be sure to read all the comments that follow the post in this link)

Enjoy!

Works fine, but is there a way to add a hyperlink to it?

Only if you use it for random flash files instead of images, since each flash file contains active code, and could have its own link associated with it. 

Quote from: UthnThanks for the code, works fine on my local version of TP BUT i can't get it to work on my public site (it just displays an empty block, no image)

I think it's related to read rights (i can't change them via chmod on my hosting), any hint ?

thanks

Did you include the modified .htaccess file on the remote host directory? Without that, the images won't serve up at all (and this only works on Apache servers, btw).  Also, make sure that nothing else is in the folder besides the .htaccess file, the main .jpg or .swf file that contains the code, and files you intend to serve up at random. Nothing else. 
Title: Re: A Random Picture/Banner Script
Post by: technodragon73 on May 02, 2006, 07:16:06 PM
QuoteOnly if you use it for random flash files instead of images, since each flash file contains active code, and could have its own link associated with it. 

Darnit...this was almost the perfect script!
Title: Re: A Random Picture/Banner Script
Post by: Uthn on May 02, 2006, 07:40:15 PM
Quote from: sdlDid you include the modified .htaccess file on the remote host directory? Without that, the images won't serve up at all (and this only works on Apache servers, btw).  Also, make sure that nothing else is in the folder besides the .htaccess file, the main .jpg or .swf file that contains the code, and files you intend to serve up at random. Nothing else.

Thanks for your reply sdl, yes i uploaded the .htaccess file to the remote host, there's nothing else in the remote dir except the '.jpg', script and .htaccess

Also checked but the host runs on Apache, so no worry with that.

i'm linking a few screenshots in case i missed something ;)

(last shot is what i get with a right click -> show image on the web version of the banner)
Title: Re: A Random Picture/Banner Script
Post by: sdl on May 02, 2006, 07:50:14 PM
Has to be the read permissions.  You should be able to see the images at least, but you can't. 

http://exdalaran.free.fr/Themes/TP_oxygen11rc2/images/banner/1.jpg

That shows up blank as well. 

When you look at the directory:

http://exdalaran.free.fr/Themes/TP_oxygen11rc2/images/banner

...none of the files are listed.  Resolve that problem, and it will probably work.
Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 02, 2006, 07:58:50 PM
Quote from: RoarinRow on May 02, 2006, 06:25:01 PM
Quote from: copter on May 02, 2006, 03:13:49 AM
Thanks Mitch! the code was very easy to use :)

Very cool, code works good.   8)

Mitch or any one who can answer, how do you make it so it opens a new browser window?
Title: Re: A Random Picture/Banner Script
Post by: Uthn on May 02, 2006, 08:02:58 PM
Quote from: sdl on May 02, 2006, 07:50:14 PM
Has to be the read permissions.  You should be able to see the images at least, but you can't. 

http://exdalaran.free.fr/Themes/TP_oxygen11rc2/images/banner/1.jpg

That shows up blank as well. 

When you look at the directory:

http://exdalaran.free.fr/Themes/TP_oxygen11rc2/images/banner

...none of the files are listed.  Resolve that problem, and it will probably work.

Strange works fine for me, proof by the picture ;)

getting weird  ???

EDIT

Fixed, used another script in this thread : http://www.tinyportal.net/smf/index.php?topic=4873.0 (http://www.tinyportal.net/smf/index.php?topic=4873.0)

Works fine for me, thanks for the help sdl :)
Title: Re: A Random Picture/Banner Script
Post by: Mitchâ„¢ on May 02, 2006, 10:29:13 PM
Quote from: RoarinRow on May 02, 2006, 07:58:50 PM
Quote from: RoarinRow on May 02, 2006, 06:25:01 PM
Quote from: copter on May 02, 2006, 03:13:49 AM
Thanks Mitch! the code was very easy to use :)

Very cool, code works good.   8)

Mitch or any one who can answer, how do you make it so it opens a new browser window?

Where it says this:
<A HREF='http://www.yoursite.com/'>

Try to replace it with:
<A HREF='http://www.yoursite.com/' target="new">

Havent tested it but it should work.
Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 03, 2006, 02:58:36 AM
Quote from: Mitchâââ,¬Å¾Ã,¢ on May 02, 2006, 10:29:13 PM
Quote from: RoarinRow on May 02, 2006, 07:58:50 PM
Quote from: RoarinRow on May 02, 2006, 06:25:01 PM
Quote from: copter on May 02, 2006, 03:13:49 AM
Thanks Mitch! the code was very easy to use :)

Very cool, code works good.   8)

Mitch or any one who can answer, how do you make it so it opens a new browser window?

Where it says this:
<A HREF='http://www.yoursite.com/'>

Try to replace it with:
<A HREF='http://www.yoursite.com/' target="new">

Havent tested it but it should work.

Nope didn't work.   ???
Title: Re: A Random Picture/Banner Script
Post by: IchBin on May 03, 2006, 03:18:00 AM
that would be target="_blank"
Title: Re: A Random Picture/Banner Script
Post by: Mitchâ„¢ on May 03, 2006, 12:59:09 PM
Oh sorry I apologize!
Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 03, 2006, 06:45:01 PM
Quote from: IchBinâââ,¬Å¾Ã,¢ on May 03, 2006, 03:18:00 AM
that would be target="_blank"

Like this? <A HREF='http://www.cafepress.com/avstyle/' target="_blank">

Cause it didn't work.   :o
Title: Re: A Random Picture/Banner Script
Post by: sdl on May 03, 2006, 08:10:06 PM
You're using single quotes for the URL. Use double quotes. The following code...



<A HREF="http://www.cafepress.com/avstyle/" TARGET="_blank"><img src="http://www.avalanchestyle.com/forum/AVS/Cowgirl_Avatar.jpg"></a>





Will produce:

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.avalanchestyle.com%2Fforum%2FAVS%2FCowgirl_Avatar.jpg&hash=c7bf16f3044a63a4693fae4a0ac0cd0fa2ffafe2) (http://www.cafepress.com/avstyle/)

(note that the target option won't work in this forum, since all URL are redirected automatically to a new window anyway)
Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 03, 2006, 08:33:15 PM
Here's a portion of the code I'm trying to use, including the new code to open the picture to a new page (target="_blank), the double quotes for the URL:

<center>
<SCRIPT LANGUAGE="Javascript">
function banner() {} ; b = new banner() ; n = 0
b[n++]= "<a href="http://www.cafepress.com/avstyle/" target="_blank"><IMG SRC='http://www.avalanchestyle-test.com/forum/GiftShop/MensRinger.jpg' BORDER='0' ALT=''></a>"
b[n++]= "<a href="http://www.cafepress.com/avstyle/" target="_blank"><IMG SRC='http://www.avalanchestyle-test.com/forum/GiftShop/WomansRaglanHoodie.jpg' BORDER='0' ALT=''></a>"
b[n++]= "<a href="http://www.cafepress.com/avstyle/" target="_blank"><IMG SRC='http://www.avalanchestyle-test.com/forum/GiftShop/WomansTracksuit.jpg' BORDER='0' ALT=''></a>"
i=Math.floor(Math.random() * n) ;
document.write( b[i] )
</SCRIPT>
</center>


Somehow it doesn't work, at least when I use the "target="_blank" code. 
Title: Re: A Random Picture/Banner Script
Post by: copter on May 03, 2006, 08:49:30 PM
try it like thIS it works ;)

Quote<p><center><SCRIPT LANGUAGE="Javascript"><!--
function banner() {} ; b = new banner() ; n = 0
//-----------------------------Database----------------------------
b[n++]= "<A HREF='URL' target='_blank'><IMG SRC='IMAGE URL' BORDER='0' ALT='TOOLTIP'></A>"
//------------------------------------------------------------------
i=Math.floor(Math.random() * n) ;
document.write( b )
//--></SCRIPT></center></p>

Bingo :D
Title: Re: A Random Picture/Banner Script
Post by: sdl on May 03, 2006, 10:35:00 PM
Yep, that works.  Roarin, remember to close the quotes on target='_blank'

Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 03, 2006, 10:59:56 PM
Quote from: copter on May 03, 2006, 08:49:30 PM
try it like thIS it works ;)

Quote<p><center><SCRIPT LANGUAGE="Javascript"><!--
function banner() {} ; b = new banner() ; n = 0
//-----------------------------Database----------------------------
b[n++]= "<A HREF='URL' target='_blank'><IMG SRC='IMAGE URL' BORDER='0' ALT='TOOLTIP'></A>"
//------------------------------------------------------------------
i=Math.floor(Math.random() * n) ;
document.write( b )
//--></SCRIPT></center></p>

Bingo :D

Yup, this worked thanks all for your support.  Our of curiousity, what does this part do - ALT='TOOLTIP'  previously Mitch's code just had - ALT=''  ?
Title: Re: A Random Picture/Banner Script
Post by: sdl on May 03, 2006, 11:04:00 PM
When you mouse over the graphic, it shows the Alternate Text in a little box. If someone has graphics disabled, or they are using a text only browser, it shows the Alternate Text instead of an image.

Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 03, 2006, 11:09:19 PM
Quote from: sdl on May 03, 2006, 11:04:00 PM
When you mouse over the graphic, it shows the Alternate Text in a little box. If someone has graphics disabled, or they are using a text only browser, it shows the Alternate Text instead of an image.



So I can actually customize that and replace the word TOOLTIP, with an actual discription of the image.   8)   That would be too professional, I can't stand it.  LOL!
Title: Re: A Random Picture/Banner Script
Post by: copter on May 03, 2006, 11:31:13 PM
LOL :D

I just highlighted TOOLTIP red, I forgot LOL
Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 03, 2006, 11:35:58 PM
Quote from: copter on May 03, 2006, 11:31:13 PM
LOL :D

I just highlighted TOOLTIP red, I forgot LOL

Not a problem, I'm just thankful it works they way I want now, with an added bonus of the TOOLTIP feature :up:
Title: Re: A Random Picture/Banner Script
Post by: zosman on May 04, 2006, 01:05:23 PM
How can i resize the gif banner...
Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 04, 2006, 03:21:09 PM
Quote from: zosman on May 04, 2006, 01:05:23 PM
How can i resize the gif banner...

I'm guess you have to resize the pics yourself.  I am using pictures that I cropped myself that are about 150x150 max. in a right block.
Title: Re: A Random Picture/Banner Script
Post by: zosman on May 05, 2006, 02:19:11 AM
Thanks sir...but been trying to resize it with irfan view..non are able to

http://www.rc-ms.com/forums1/rcwarbirds.gif
Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 05, 2006, 03:27:01 AM
I use a program called, 'Avatar Capture' to resize pics  It's free - http://www.soft32.com/download_18396.html

I had to strip the spyware from it, but other than that, it works great.
Title: Re: A Random Picture/Banner Script
Post by: zosman on May 05, 2006, 03:43:11 AM
But it only capture and save to jpeg and i love all the animations
Title: Re: A Random Picture/Banner Script
Post by: RoarinRow on May 05, 2006, 03:54:30 AM
Quote from: zosman on May 05, 2006, 03:43:11 AM
But it only capture and save to jpeg and i love all the animations


oh o.k. then you'll need something more powerful that 'Avatar Capture'.   :o
Title: Re: A Random Picture/Banner Script
Post by: whoesa on June 05, 2006, 09:25:22 PM
Quote from: elpvn on April 12, 2006, 03:17:00 PM
It's nice for set as a dinamic logo but I like it get the pictures from a gallery than rather :)

Quote from: SlideShowScript<SCRIPT LANGUAGE="JavaScript"><!--

var slideShowSpeed = 2000;
var fadeDuration = 3;

fadeimgarray = new Array();
fadeimgarray[0] = 'images/1.jpg';
fadeimgarray[1] = 'images/2.jpg';
fadeimgarray[2] = 'images/3.jpg';
fadeimgarray[3] = 'images/4.jpg';

var t
var j = 0

var preLoad = new Array()
for (i = 0; i < fadeimgarray.length; i++){
   preLoad = new Image()
   preLoad.src = fadeimgarray
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=fadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()     
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (fadeimgarray.length-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
//--></SCRIPT>

<BODY BGCOLOR="#FFFFFF" onLoad="runSlideShow()">

<IMG SRC="images/1.jpg" NAME="SlideShow" BORDER=0>

Demo here: http://www.crowes.f9.co.uk/Javascript/slideshow.htm ;)


Hi, how do i get this script working on my site?

I've been trying many ways but i can't get i working  :-\

Could anybody explain me what to do? I really like this one  :)
Title: Re: A Random Picture/Banner Script
Post by: IchBin on June 05, 2006, 09:36:14 PM
So what have you done? What have you tried? Did you try putting the code in a javascript/html block?
Title: Re: A Random Picture/Banner Script
Post by: whoesa on June 05, 2006, 10:02:38 PM
-First i made a file called images.
-Then i putt my images there called 1.jpg, 2.jpg, 3.jpg there. All same size(150 x 70)
-I putt that file(images) in smf directory, so i have: root/smf/images
-Next i putt this code in a javescript block

It only shows 1.jpg  ???

I think i do something very wrong here  :)
Title: Re: A Random Picture/Banner Script
Post by: IchBin on June 05, 2006, 10:11:34 PM
Very odd if you did all that right. Hard to say what it is without looking at your setup and code.
Title: Re: A Random Picture/Banner Script
Post by: PokerOwnage on June 05, 2006, 11:38:00 PM
Quote from: whoesa on June 05, 2006, 09:25:22 PM
Quote from: elpvn on April 12, 2006, 03:17:00 PM
It's nice for set as a dinamic logo but I like it get the pictures from a gallery than rather :)

Quote from: SlideShowScript<SCRIPT LANGUAGE="JavaScript"><!--

var slideShowSpeed = 2000;
var fadeDuration = 3;

fadeimgarray = new Array();
fadeimgarray[0] = 'images/1.jpg';
fadeimgarray[1] = 'images/2.jpg';
fadeimgarray[2] = 'images/3.jpg';
fadeimgarray[3] = 'images/4.jpg';

var t
var j = 0

var preLoad = new Array()
for (i = 0; i < fadeimgarray.length; i++){
   preLoad = new Image()
   preLoad.src = fadeimgarray
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=fadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()     
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (fadeimgarray.length-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}
//--></SCRIPT>

<BODY BGCOLOR="#FFFFFF" onLoad="runSlideShow()">

<IMG SRC="images/1.jpg" NAME="SlideShow" BORDER=0>

Demo here: http://www.crowes.f9.co.uk/Javascript/slideshow.htm ;)


Hi, how do i get this script working on my site?

I've been trying many ways but i can't get i working  :-\

Could anybody explain me what to do? I really like this one  :)

could it be do to the whole
Quote<IMG SRC="images/1.jpg" NAME="SlideShow" BORDER=0>
part?

i dunno just guessing
Title: Re: A Random Picture/Banner Script
Post by: whoesa on June 05, 2006, 11:50:46 PM
Well i have no idea what is wrong  :)

It is working very nice on this site but for me it only shows first image
http://www.crowes.f9.co.uk/Javascript/slideshow.htm

I guess i need a code master here  ;)
Title: Re: A Random Picture/Banner Script
Post by: PokerOwnage on June 06, 2006, 04:34:26 AM
im kinda interested in the directory structure, and the whole code file...

id be happy to take a look for you
Title: Re: A Random Picture/Banner Script
Post by: whoesa on June 07, 2006, 04:35:39 PM
Well it's not 100% the perfect script anyway for me. I like that the images are fading but i want to use each images as a link to an other site.
I have no idea if this is possible with this script or if there is an other script that works like that.

Anyone with an idea?
Title: Re: A Random Picture/Banner Script
Post by: nosgr on August 19, 2006, 08:10:14 AM
How can i add this to a block?
Title: Re: A Random Picture/Banner Script
Post by: akulion on August 19, 2006, 08:48:30 AM
to add to a block put all thsi code in a Script box



<center>
<SCRIPT LANGUAGE="Javascript">
function banner() {} ; b = new banner() ; n = 0
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
b[n++]= "<A HREF='http://www.yoursite.com/'><IMG SRC='http://www.yoursite.com/image.jpg' BORDER='0' ALT=''></A>"
i=Math.floor(Math.random() * n) ;
document.write( b[i] )
</SCRIPT>
</center>



in each line specify your site address and image address in the code above for it to work
Title: Re: A Random Picture/Banner Script
Post by: prometheus fire on October 30, 2009, 03:16:28 AM
I just found this, very straightforward and clean.  I'm still in the process of building up my banners, but I want to have a mouse-over popup/tooltip when someone mouses over a banner.

Initially, I want it to say, "Advertise with us" but eventually it will be the name or blurb about my advertisers.

In addition to the reference link that takes the user out to the linked page, what kind of code is used to cause a mouse-over?  What would I need to add to each line/link/image command?

Yes, I am very new to this.  That kind of coding is probably simple, I just don't know where to look.

Thanks for any help you all can provide.
Title: Re: A Random Picture/Banner Script
Post by: IchBin on October 30, 2009, 01:33:12 PM
If you want a tooltip to show when a person does a mouseover you just need to add something to the title.
<a href="link/to/site.html" title="Advertise with us"><img here></a>

You should also pay attention to how old the topics are. The last post in here was over 2 years ago.... Would be better if you just start a new topic and reference anything you think is related.
Title: Re: A Random Picture/Banner Script
Post by: prometheus fire on October 30, 2009, 06:44:22 PM
Thanks, sorry.  I wan't sure if it was better to start a new topic or add to the already created one.   The information doesn't really get old, and this is the thread that is linked to from the blocks indexhere (http://www.tinyportal.net/index.php?topic=4983.0).

Thank you for the help though, it was very useful to me.  While the script is old, it's basic and straightforward enough not to really be out of date.  Knowing how to alter the code to get the most out of it is helpful.

I am new here and I don't want to break any rules of the neighborhood.  I noted your comment and re-read your posting rules.  Thanks.