Results 1 to 2 of 2
Thread: Javascript change image
- 12-11-2009, 12:04 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 1
- Rep Power
- 0
Javascript change image
Hey guys!
ok so i found this open sources js coding that will simply randomly choose 1 image out of a whatever is given
so i made it pretty much give a table tag, a background.
pretty simple. check it out:
PHP Code:// JavaScript Document <!-- function random_imglink(){ var myimages=new Array() myimages[1]="images/marble1.jpg" myimages[2]="images/marble2.jpg" myimages[3]="images/marble3.jpg" myimages[4]="images/marble4.jpg" myimages[5]="images/marble5.jpg" myimages[6]="images/marble6.jpg" myimages[7]="images/marble7.jpg" myimages[8]="images/marble8.jpg" myimages[9]="images/marble9.jpg" myimages[10]="images/marble10.jpg" var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 document.write('<table id="mainbody" style="background: #FFC url('+myimages[ry]+') top left;">') } random_imglink() //-->
PHP Code:<a href=""><img src="icon.gif"></a>
and then ill have the same setup for myimage[2]
so ill have an array of little icons that each one will change the table background to a given image.
but of course keeping the randomly choosing a background image each time the page loads.
do you guys have any ideas on how this would be possible?
thanks guys :)
-
You will have better luck getting help with this if you post the question on a javascript forum. This forum is for Java.
Much luck!
Similar Threads
-
how to change windows xp background image through java
By erosenthil in forum Advanced JavaReplies: 1Last Post: 08-18-2009, 01:57 PM -
[SOLVED] manipulating the pixel values of an image and constructinf a new image from
By sruthi_2009 in forum AWT / SwingReplies: 14Last Post: 04-10-2009, 09:46 AM -
javascript
By fiero in forum New To JavaReplies: 1Last Post: 09-22-2008, 02:45 PM -
Converting multiple banded image into single banded image... Image enhancement
By archanajathan in forum Advanced JavaReplies: 0Last Post: 01-08-2008, 06:29 PM -
Jsp and javascript
By Ed in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 07-04-2007, 05:54 AM
Bookmarks