|
Web dev and programming discussions forums
|
|
|
|
||
View original thread with replies |
|||
| Tags: | , | ||
How to add a URL to each image in this random image selector code?Hey folks..
Hope you can help, I'm completely new to this and have no knowledge at all when it comes to javascript. Have been using this script on my site for a while. Is there anyway I can add a URL link to the images that are in my selector? When clicked would go to that page on my website. Thanks in advance of any help Nat <script language="JavaScript"> /* Random image slideshow- By Tyler Clarke (tyler@ihatecoffee.com) For this script and more, visit http://www.javascriptkit.com */ var delay=10000 //set delay in miliseconds var curindex=0 var randomimages=new Array() randomimages[0]="http://www.anywebsite.com/images/splash1.jpg" randomimages[1]="http://www.anywebsite.com/images/splash2.jpg" randomimages[2]="http://www.anywebsite.com/images/splash3.jpg" randomimages[3]="http://www.anywebsite.com/images/splash4.jpg" randomimages[4]="http://www.anywebsite.com/images/splash5.jpg" var preload=new Array() for (n=0;n<randomimages.length;n++) { preload[n]=new Image() preload[n].src=randomimages[n] } document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">') function rotateimage() { if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){ curindex=curindex==0? 1 : curindex-1 } else curindex=tempindex document.images.defaultimage.src=randomimages[curindex] } setInterval("rotateimage()",delay) </script> Random image on refreshHi, everybody.
Got a problem with a specific thing. I got lost when trying to make simple header image rotating with 2 other images after refresh. Want to have different image in header after refreshing a browser and should be linkable as well. here is the code I need to modify: $style_td = ' style="background-image: url(\''.$setting['shop']['url'].'img/blue.jpg\')"'; Thanx for help. random image from tablehi friends,
again a problem I have a mysql table name tbl_admin fields are below id(int), image1(text), image2 (text) , image3 (text) now i want to show these pics, i use randomly function to display them $query=select * from tbl_admin where id=5; now for show i use <img src="<? rand($row['image1'],$row['image2'],$row['image3'])"> Problem occur when image1 or image2 or image3 is blank than sometime image show blank,,, but i don't want to show up blank, if there is only 2 images then show only 2 images randomly, if there is only one show only one Thanks Random image scriptDoes anyone have a script, that can display a random image of the images I select?:confused:I'm going to use it for a type of captcha. I think this would be easier in javascript, so yes I am in the right section.
Random image script helpHi, im wondering if anyone can help me, i have a random image script and it works fine, apart from when you click on the images they link to the right place but ALL go to _self
I want [2],[3]and[6] to link to the places they are already linking to but _blank NOT _self, does anyone know how to do this, it would be a massive help :) Below is the code for the script i am using: Code:
<script language="JavaScript">Photopost Pro Random Image WidgetHey all,
One of the things that I missed from my transition from Drupal to vBCMS was my Photopost random image block. It's one of the features that my visitors seem to really like as well. After some trial and error, I managed to create a working vBCMS widget that utilizes the "Random Image Anywhere ........ For the full text, visit vBulletin.org Random image links open new tabConfused on how to change this code so when an image is clicked it opens link in a new window or tab, (yes my first try at playing with coding)
<br> <script language="JavaScript"> <!-- function random_imglink(){ var myimages=new Array() myimages[1]="image" myimages[2]="image" myimages[3]="image" var imagelinks=new Array() imagelinks[1]="http://" imagelinks[2]="http://" imagelinks[3]="http://" var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>') } random_imglink() //--> </script> </p> <br/> Loading Random Background ImageI'm trying to use jQuery to load a random background image in a header in Wordpress. I can't get it to work at all. Is there something wrong with my code?
JavaScript Code:
$(document).ready(function() {
var randomImages = ['home-bg-1','home-bg-2','home-bg-3'];
var rndNum = Math.floor(Math.random() * randomImages.length + 1);
$("#wrapper-home").css({ background: "url(images/home-bg-" + rndNum + ".jpg) left 48px no-repeat" });
});
In Firebug I can see it loading the random image "background-image:url(images/home-bg-1.jpg);" as an element style to #wrapper-home div. This is in a header-home.php file in the main wp-content directory. The images are in the images/ folder in the same directory. alt text in random image .js fileHi,
Please see this URL: http://backstageweb.net/Freedom10/TestPage.html (refresh a few times) and attached random image .js file (for banner images). Is there any way to add "alt" attributes to the images in the .js file? Thanks, John Random image block from a directoryHello, Is there any way I can create a Random image block that will work from a directory I choose? I don't need anything fancy. I just want to place a few images in a dir and have them randomly shown in a block. Thanks, Stuart PHP Registration random code image verificationI have seen on many registration pages now the use of a
random character set - converted to an image which users have to
enter to verify that they are not an auto fill robot.
On a php registration page (Insert record), does anyone know how to do this? I'm using DW and I assume its something to do with a random number generator with a swf converter....? random image slide show not workingWhen I preload my images via an Array, my automatic slide show doesn't work. My code is below. Any help is appreciated.
<head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>JS - Image Object - Creating a Random Image Slide Show</title> <script type="text/javascript"> <!-- var imageList = new Array (); imageList[0] = new Image (); imageList[0].src = "_external_files/Image1.jpg"; imageList[1] = new Image (); imageList[1].src = "_external_files/Image2.jpg"; imageList[2] = new Image (); imageList[2].src = "_external_files/Image3.jpg"; imageList[3] = new Image (); imageList[3].src = "_external_files/Image4.jpg"; //--> </script> </head> <body> <img src="_external_files/Image1.jpg" name="slideShow" width="600" height="400" alt="people and things" /> <script type="text/javascript"> <!-- function slideShow () { var imageNumber = (Math.floor(Math.random () * imageList.length)); // determines a random image number document.images.slideShow.src = imageList[imageNumber]; window.setTimeout ("slideShow ();", 3000); } window.setTimeout ("slideShow ();", 3000); slideShow (); //--> </script> </body> </html> Multiple Random Image links from a FolderHey Ive read through the other forums on the topic, but I haven't done this in a long time. I am just starting the project so I don't have much to show for it yet.
What I have is a site with about 10 pictures, each of these pictures needs to be randomly pulled from folders, each picture slot will have its own folder, due to it being categorized. When the picture is clicked i need it to open a new page with the document associated to the picture. Is there a way to do this without having to rewrite the code every time? Because as there are new documents added at the end of each week. Unfortunately the server I use doesn't support PHP, but if it has to be done in PHP I can switch. Like I said though I haven't messed around with web design in a long time, so if someone could essentially spell this out for me I would be extremely grateful. Widget: display random image thumbnail from public albumsWhat it does ?
This widget displays a thumbnail image, taken randomly from any public albums and adds a "More..." link redirecting to albums. Clicking on the thumbnail opens full sized picture in its current album. Version history : 1.0: Initial release Install instructions : 1- Go in to your AdminCP > vBulletin CMS > Widgets > Crea ........ For the full text, visit vBulletin.org Random ProblemI'm trying to write a PHP script that selects two random words from a database. It's just for a little fun thing I have in mind.
The code I am using is such: PHP Code:
Three Stole My Two I get this: Resource id #3 Stole My Resource id #4 I have no idea what is going wrong here, and I was hoping someone could provide the answer. I got the code snippets from a tutorial, and I followed said tutorial to the leter!
Set Slideshow Script to Start on Random Image
Jan 16, 2010 Hi, I'm using the below script for a simple slideshow. What I would like to do is edit it so that it starts with a random image ie. not always on image 1. How can I do this? <ul class="fadein" onmouseover="stop_slideshow()"...
Importing a client side library that has no "exports" Mar 1, 2010 Hi, I'm new to this group, so I might be talking crap, but I wonder if there is/will be an API to import a library that doesn't explicitly "export" any object? It would make it easier to import a client side library.
Problem to Display Image at IE8 browser Jan 5, 2010 Dear Sir, i am developing a project in which i waht to show image after browsing.My problem is when i browse image at IE7 or previous version it displayed but this ih not work at IE8 and Firefox broswers. Please help me... Thank in advance.. ...
Sprite image mechanism problem on IE Mar 8, 2010 I am facing a problem when using sprite images in my CssResource class. Problem occurs when creating a CSS styled menu with UL and LI that uses background-images as menu icons. I used GWTs ClientBundle, CSSResource with @sprite that generates…
Form submit with image problem Nov 30, 2009 Hi, <?php echo $form->submit('Edit', array('edit.jpg')); ?> Should the code above produce a submit button with my edit.jpg (located in webroot/img) ? I've tried this a couple of ways and check the API but even that seems jacked up as it...
problem refreshing an image in a dialog box Feb 11, 2010 I am having problems refreshing an image in a dialog box. If I move the div outside of the dialog box, it works fine with this: var img = db_cgi_url + "/photo.cgi?do=view;ID=" + ID + ";" + now.getTime(); $("#myImage").attr("src",...
Reg: Image slide show problem Feb 26, 2010 Hi, I am using image slide show in image. Now i change that image to swf file. Now it wasn't working. All swf file was listing in same page. Actually only one swf file was display. Arrow was click then another one is display. But now all swf...
Image Actas Behavior Problem Nov 23, 2009 I am facing some problem to use Image Actas Behavior where I want to add multiple data for a model. I have Business and Bizimage model. From a single form, I have to add an single entry for Business and multiple entry for Bizimage. When there is no...
Problem with reloading image resource after resizing Mar 4, 2010 Hi, I have a problem with Image resource. I'm currently in development mode and I try different design for my website. In my website (in GWT 2.0) I integrate Image, but when I resize image (with Gimp), impossible for GWT to take account the new...
Firefox problem with custom image buttons Dec 16, 2009 Hi, I create buttons with custom images like this var myButton = [[CPButton alloc] initWithFrame:CGRectMake(10, 10, 20, 20)]; [myButton setPosition:CGPointMake(10, 10)]; [self addSubview: myButton]; [myButton setImage:[[CPImage alloc]...
Universal Exports, at your service
Apr 16, 2009 Universal Exports, at your service Apr 16, 2009 Facebook Now Bulk Exports Phone Numbers Jan 6, 2010 USB Hourglass random number generator Dec 23, 2009 USB Hourglass random number generator Dec 23, 2009 RFC #0196: I/O Collections random access Nov 19, 2009 Creating Random Playlists in iTunes 8 Sep 9, 2008 Keep Up With Your Fave Random House Author on Your iPhone Dec 21, 2009 Chatroulette Clones: A New Market for Random Connections Feb 26, 2010 Random festivities for Lefty O'Doul's Bloody Mary mix Nov 26, 2009 | |||