By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,494 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,494 IT Pros & Developers. It's quick & easy.

_HELP Modifying Script Create Random Linked Image Blend Script

P: 1
I have been trying to modify a script that i had working in the past but have lost..

ORIGINAL URL:
http://www.thescripts.com/forum/thread147097.html

STEPS:
I want it to do the following:
1-Load a Random Image each time page loads or is refreshed / script starts (with corresponding url link when clicked)
2-Images change by blend/fade into one another, on an adjustable time delay
3-Next image loaded also loads new corresponding url/link
4-That the Images loaded are selected randomly from either a source directory or via file locations entered and not in same sequence as are the corresponding urls..

Below is the script so far:

PLEASE ANSWER IN LAYMANS TERMS QUOTING FULL SCRIPT AS I AM A NOVICE!

Many Thanks!

SCRIPT:

Here's the code:

Expand|Select|Wrap|Line Numbers
  1. <HEAD>
  2.  
  3. <script language="JavaScript1.1">
  4. <!--
  5.  
  6. //specify interval between slide (in mili seconds)
  7. var slidespeed=3000
  8.  
  9. //specify images
  10. var slideimages=new Array("image1.gif","image2.gif","image3.gif")
  11.  
  12. //specify corresponding links
  13. var slidelinks=new Array("http://www.whatever.com","http://whatnever.com","http://www.always.com")
  14.  
  15. var newwindow=1 //open links in new window? 1=yes, 0=no
  16.  
  17. var imageholder=new Array()
  18. var ie=document.all
  19. for (i=0;i<slideimages.length;i++){
  20. imageholder[i]=new Image()
  21. imageholder[i].src=slideimages[i]
  22. }
  23.  
  24. function gotoshow(){
  25. if (newwindow)
  26. window.open(slidelinks[whichlink])
  27. else
  28. window.location=slidelinks[whichlink]
  29. }
  30.  
  31. //-->
  32. </script>
  33.  
  34. </HEAD>
  35.  
  36. <BODY>
  37.  
  38. <a href="javascript:gotoshow()"><img src="image1.gif" name="slide"
  39. border=0 style="filter:blendTrans(duration=3)" width=97
  40. height=100></a>
  41.  
  42. <script language="JavaScript1.1">
  43. <!--
  44.  
  45. var whichlink=0
  46. var whichimage=0
  47. var blenddelay=(ie)? document.images.slide.filters[0].duration*1000 :
  48.  
  49. function slideit(){
  50. if (!document.images) return
  51. if (ie) document.images.slide.filters[0].apply()
  52. document.images.slide.src=imageholder[whichimage].src
  53. if (ie) document.images.slide.filters[0].play()
  54. whichlink=whichimage
  55. whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
  56. setTimeout("slideit()",slidespeed+blenddelay)
  57. }
  58. slideit()
  59.  
  60. //-->
  61. </script>
  62.  
  63. [color=blue]
  64. >//specify images
  65. >var slideimages=new Array("image1.gif","image2.gif","image3.gif")[/color]
  66.  
  67. function shuffle(arr) {
  68. for (var i = arr.length - 1; i > 0; i--) {
  69. // Interchange element i with a random element not after it
  70. var j = Math.floor((i + 1) * Math.random());
  71. var t = arr[i];
  72. arr[i] = arr[j];
  73. arr[j] = t;
  74. }
  75. }
  76.  
  77. shuffle(slideimages);

I Cant get it to do steps 1-4
ANY HELP THANKS..
Oct 7 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Welcome to TSDN!

What happens so far? Do you get errors?

Please use code tags when posting code:
[CODE=javascript]
JavaScript code here...
[/code]
Oct 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.