Random Pictures
Aug 7, 2005
I'm new at Javascript, and have written a script for a series of random
roll-over button images, but one thing I would like to add is a function
that checks to make sure that there are no duplicates in the randomly
generated variables that choose the pictures.
Can anyone give me a hand with this? One other thing I can't seem to figure
out is how to manage the "onLoad" aspect of caching my roll-over images (DW
has locked the <body onload> function into a template, so I can't mess with
it...). so my rollover graphics are grabbed from the server in "real time"
during mouse-over, which is a bit "goofy" and "slow" in terms of instant
rollover effect. I'm sure that there is a much more efficient way of doing
this, but I've been able to learn a lot by tweaking DW's way of doing
things, so it's not a total loss.
In an external JS file, I set up a series of 10 random variables using the
Math.random and Math.round functions like so:
var btn0 = Math.random()*100;
btn0 = Math.round(btn0);
var btn1 = Math.random()*100;
btn1 = Math.round(btn1); .... etc for 10 buttons
Then in my page, I piggy-back onto Dreamweaver's built-in roll-over
handlers, like so (to write the instances of each rollover image);
<script>document.write('<a href="link1.htm" onMouseOut="MM_swapImgRestore()"
onMouseOver="MM_swapImage('pic1','','images/btns/'+btn0+'b.jpg',1)"><img
src="images/btn/'+btn0+'a.jpg" name="pic1" width="80" height="100"
border="0"></a>');</script>
For this particular page, I'm pretty much stuck with DW's coding because
it's locked into a template that governs my site navigation. Thanks for any
pointers or help ...
View 4 Replies
ADVERTISEMENT
Jul 16, 2011
On my website, I have random logos appear on the home page as products that I recommend. I would like to make these logos into links to the website they are from, so that when one clicks on the picture, it directs you to the site, but I can't quite get it to work, and I know very little about Javascript (as you may know from my previous question about Javascript).
Here's my current JS code:
<!--
// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
[Code].....
View 6 Replies
View Related
May 28, 2010
I have 3 background images, and 1 is picked at random to be the background image of the body when loading the page.My code is below. Right now it's just white, can't get any pictures to load. I have checked the URLs and they are correct.
[Code]...
View 1 Replies
View Related
Sep 1, 2010
I am looking for a upload form to upload pictures and then when the pictures are uploaded, then they get emailed to me. Kind of like a contact form but attached is the pictures.
View 1 Replies
View Related
Aug 31, 2011
I'm trying to use Javascript to have an array of images that load randomly AND work in a slideshow manner so change every 3 seconds (in a logical order). The code I have below presents a random image but how do I get them to continue from the random image and change to the next every 3 seconds?
<script language="JavaScript">
images = new Array(3);
images[0] = "<a href = 'photo1.html'><img src='images/photo1.jpg' alt='Photo 1'></a>";
images[1] = "<a href = 'photo2.html'><img src='images/photo2.jpg' alt='Photo 2'></a>";
images[2] = "<a href = 'photo3.html'><img src='images/photo3.jpg' alt='Photo 3'></a>";
[Code]...
View 4 Replies
View Related
Aug 6, 2009
I've looked for a solution to this issue, but it seems like a little different scenario than other situations. I made a system for generating friend requests on Facebook. I have a grid that is 6 x 3, for a total of 18 cells. Each cell has a picture in it, and the picture is linked to the Facebook friend request page. My problem is that since each cell is populated at random from the array, I'm getting lots of repeats. For example, some picutures are in 5 cells, and some are in none. I'm trying to figure out how to make it so that once a picture is used once in the grid, it does not get used again in the same grid.I still want every cell filled at random on each page load, I just want to prevent the repeating.
Here's my current code:
<script type="text/javascript">
var vip_list=new Array(
new Array('http://profile.ak.fbcdn.net/v225/1616/88/s1220771654_2158.jpg','http://www.facebook.com/addfriend.php?id=1220771654'),
new Array('http://profile.ak.fbcdn.net/v223/1233/29/s904885342_9055.jpg','http://www.facebook.com/addfriend.php?id=904885342'),
[Code]...
View 6 Replies
View Related
Apr 18, 2011
For my website I would like to create a famous last words generator (randomized), and random page generator (within my site). What is the code for random quotes and random links?
View 2 Replies
View Related
Dec 14, 2011
I am new to javascript but have been using java for quite a while. I am looking to make a random quote (out of ten possible quotes) appear in my h2 tag in a page i am working on. In java, i would make a random number generator, in javascript it looks like this:
Code:
var randomnumber=Math.floor(Math.random()*11)
Then make an if statement:
Code:
if randomnumber=1 {
var quote="Live long and prosper"
}
document.write(var quote); Could someone more experienced than me tell me if my code looks good and how would a go about getting "var quote" in my h2 tag?
View 3 Replies
View Related
Jul 20, 2005
What is the javascript for reloading images upon the loading of each
page on a website. Also, how do I implement this in the HTML.
View 3 Replies
View Related
Mar 10, 2011
Should I just make this a small video, or will JS be able to handle around 25 pictures without being really slow?
View 1 Replies
View Related
Mar 15, 2006
Is it possible to rotate pictures 45°CW for each click using javascript?
View 1 Replies
View Related
Oct 20, 2010
do ya know an efficient way to get the coordinates of a pictures so that I can use them to create a map? It is a rectangle. Here is the code I set up for a page:
<HTML>
<HEAD>
<TITLE>Cyrus</TITLE>
</HEAD>
<BODY BGCOLOR=black>
<div align="center">
<table border="0"; cellspacing="0"; cellpadding="0">
[Code]..
View 26 Replies
View Related
Jul 23, 2005
I have this list of pictures;
<script type="text/javascript">
var picssigs = new
Array("sigs/finished1.jpg","sigs/foghorn.jpg","sigs/motto.jpg","sigs/sig.jpg","sigs/SWAT.jpg","sigs/title.gif");
var pictsigs = Math.round(Math.random()*(picssigs.length-1));
for (var i=0; i<picssigs.length; i++) {
var imgsigs = new Image();
imgsigs.src = picssigs[i];}
How do I display these pictures like;
<pic1> <pic2> <pic3> ...etc...
<pic4> <pic5> ...etc...
View 3 Replies
View Related
Jul 23, 2005
I will show you how to get rid of <a> tags to put links on pictures.
When you want to put a link to another page on a picture, you type this
kind of HTML code :
<a href="page.html" style="text-decoration:none;" alt="funny things....">
<img src="img12.gif" alt="funny things ..." border="0"></a>
But when you click on the image, you can see a dotted border around it.
If you type this instead :
<img src="img12.gif" alt="funny things ..." border="0"
onclick="this.location='page.html'" style="cursor:hand;">
I think it is better, especially when you have frames in your website.
View 2 Replies
View Related
Jan 12, 2006
Is there some way in JavaScript to stop the downloading of pictures from a
web page?
View 23 Replies
View Related
Jun 15, 2006
I wish to access several pictures on my page by defining them as an array. This way I can either loop through them or access them by array index.
What I am really doing is writing my own picture gallery and slide show. The reason I am doing this is so that I can have my web page look exactly the way I want. In addition, it is an excellent way to learn Javascript.
View 2 Replies
View Related
Dec 23, 2006
I build my first Drag & Drop with JavaScript and I would like to drag
the pictures when I click on it.
When I create a normal div tag with some text the script works, but
when I put a image in the div tag it works not correctly.
Here is my Code... I integrated three pictures and one text, then you
can see the differences.
a part of my html site:
View 2 Replies
View Related
Mar 14, 2009
I just spent 3 hours analyzing tons of lightboxes, image galleries, jQuery plugins. Now I'm a bit frustrated.I don't want a snazzy animation effect.I don't want a pre-made layout.This is what I want:On page load, 12-15 bigger images are preloaded into browser cache.Div#container contains a default image.When user clicks a thumbnail link, the corresponding (bigger) preloaded image shows inside #container.
View 1 Replies
View Related
Aug 10, 2009
i have my folder with index page in named "tester_fixed.html" and then a folder for images where i have place header1 header 2 and header 3 . i downloaded a script from [URL] and edited my images in and i think i mucked up as they are not showing.
the code:
<script type="text/javascript">
// Flexible Image Slideshow- By JavaScriptKit.com (http://www.javascriptkit.com)
// For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/
[Code]....
View 2 Replies
View Related
Feb 9, 2010
i look everywhere for html and Java snip its and all seem to be different, can somebody please tell me how to code something like this,also can the code be easy ish for example.if show is 5pm till 6pm an image appearsif show is 6pm till 7pm an image appears
View 2 Replies
View Related
May 18, 2010
I am using a jquery gallery slideshow on my homepage and I am having an issue where the images loaded before the dom is loaded causing the images to display in an ugly stack.
I combated this a bit by setting a height on the div and setting the overflow to hidden. however you can still see the unstyled stack of images within the small div for a couple of seconds before the page is loaded.
the code to start the javascript is:
<script type="text/javascript">
$(document).ready(function(){
$('#photos45').galleryView({
panel_width: 980,
[Code]....
I have a feeling that this has something to do with the .ready function maybe it should be something else? You can see this in action here:
[URL]
View 3 Replies
View Related
Dec 20, 2011
Im trying to edit a homepage for a friend of mine. He wants the page to have a table of 12 total pictures that randomly rotate on refresh.i found this code that refreshes the pictures:
<script type="text/javascript">
<!--
var rand=Math.round(Math.random()*1);
[code]....
View 4 Replies
View Related
Oct 27, 2011
I implemented the plugin of jquery.cycle.all.min.js as suggested in a previous thread by Sitepoint users but now it appears, I can't add more then 13 pictures to the gallery. The gallery works with over 13 pictures, but the prev/next buttons don't appear anymore and don't work. So I was wondering if anyone knows the explanation and solution for this?I rechecked everything and I've got it on multiple pages that over 13 pictures you can't press or see the next/prev buttons!
View 4 Replies
View Related
Oct 22, 2007
I want to know if how a javascript can recognize the name of a picture. Let say i have two pictures.
Picture A. name is "bubble.jpg"
...then
Picture B. name is "duck.jpg"
When i hover the mouse using the onmouseover() function on one of the picture. The javascript should smart enough to recognize the name of the picture and display the name of that picture. Is this possible?
View 2 Replies
View Related
Aug 20, 2009
For this page here: [URL]. I have the following code for the photo gallery:
var thumbProportion = .17 // thumbnails are 32% of their full size;
var IE = false;
if (navigator.appName == "Microsoft Internet Explorer"){IE = true;}
function swapImg(nImg,nSwapImgClass,nFullSizeImg,nCaption){
var thumbImg = nImg;
var thumbImgAlt = thumbImg.alt;
var origFullWidth = nFullSizeImg.width;
var origFullHeight = nFullSizeImg.height; .....
IE ? attachEvent('onload', init) : addEventListener('load', init, false);
The pictures change fine, but I can't get the captions to change with them.
View 4 Replies
View Related
Feb 1, 2010
I have 4 pictures (Picture_1, Picture_2, Picture_3, Picture_4) and 2 buttons. I am trying to make it so that when you click the 'next picture' button it increments a variables andchanges the current picture to the next one ("Picture_" + CurrentPicture) I am aware that I would need to delete the current picture before creating the next one but I am unsure how to do this I use document.write("<img src = 'Picture_Example'>") to display my picture but if there is a better way Here's all my code:
<html>
<head>
<script language = "javascript" type = "text/javascript">
[code]...
View 2 Replies
View Related