473,769 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change one image to 27 different images

Hello!
Im going to make a javascript for changing alot of images. But im not
sure how to do it., where to start..

Ok, first.. this is the isue.

I have 3 images(I call them 1a-3a).
when u click on image 1a u change" image x" to image 1a
when u click on image 2a u change" image x" to image 2a
when u click on image 3a u change" image x" to image 3a

So far Im in the game. But..

Then I have 8 other images(I call them 1b-8b).
So if u click on image 1a u change "image x" to 1a. Then if I click on
image 1b I want image 1a(the changed "imagex") to change.

(click on 1a-3a and change "image x"--> click on image 1b-8b -->
change the images 1a-3a) Messy? I know.

<tr><td>
[1a.gif]-[2a.gif]-[3a.gif]
</td></tr>

<tr><td>
[1b.gif]-[2b.gif]-[3b.gif]-[4b.gif]-[5b.gif]-[6b.gif]-[7b.gif]-[8b.gif]
</td></tr>

<tr><td>
[image x.gif]
</td></tr>

This makes the possibilty og 27 different images(hm.. i think

Do anyone know how to do this or hav anyone done something like this?
"Imagex" is a Box and the 1a-3a changes pattern. The other 1b-8b
changes color. SO it should be possible to first change pattern, then
change color on the pattern u choosed before.

Aight?

Regards

Y-man
Jul 20 '05 #1
1 3219
@SM
Spike a ecrit :

Hello!
Im going to make a javascript for changing alot of images. But im not
sure how to do it., where to start..
very easy indeed !
(won't run on NC4.x)

<html>
<script type="text/javascript">
function init(){
if(document.ima ges)
start = document.images['image_x'];
}
function changeImage(las tImage){
start.src=lastI mage.src;
start=lastImage ;
}
onload=init;
</script>
<style type="text/css">
body{text-align:center;}
img { width=90px; height=40px;}
table { margin:auto;}
</style>
<h2>First Game</h2>
<table><tr>
<td>Begin with this <br>image ==></td>
<td><img src='ax.gif' onclick="change Image(this);"></td>
<td>continue with<br>any other image</td>
</tr><tr>
<td><img src='a1.gif' onclick="change Image(this);"></td>
<td><img src='a2.gif' onclick="change Image(this);"></td>
<td><img src='a3.gif' onclick="change Image(this);"></td>
</tr><table>
<table><tr>
<td><img src='a4.gif' onclick="change Image(this);" name="image_x"> </td>
<td><img src='a5.gif' onclick="change Image(this);"></td>
<td><img src='a6.gif' onclick="change Image(this);"></td>
</tr></table>

<h2>Second Game</h2>

<script type="text/javascript">
function patern(lastImag e){
document.images['image_y'].src=lastImage. src;
}
function changeColor(col or) {
if(document.get ElementById)
document.getEle mentById('Ix'). style.backgroun dColor=color;
}
</script>
<style type="text/css">
#Ix {background-color:silver;}
</style>

<table><tr>
<td>Choice a color<br>below</td>
<td id='Ix'><img src='empty.gif' name="image_y"> </td>
<td>continue with<br>chosing a patern</td>
</tr><tr>
<td><img src='blue.gif' onclick="change Color('blue');" ></td>
<td><img src='red.gif' onclick="change Color('red');"> </td>
<td><img src='yellow.gif ' onclick="change Color('#ff0');" ></td>
</tr></table>
<table><tr>
<td><img src='p1.gif' onclick="patern (this);"></td>
<td><img src='p2.gif' onclick="patern (this);"></td>
<td><img src='p3.gif' onclick="patern (this);"></td>
<td><img src='p4.gif' onclick="patern (this);"></td>
</table>
</html>
empy.gif is a transparency gif
p1, p2, pn.gif are paterns gif with transparent background

Do anyone know how to do this or hav anyone done something like this?
"Imagex" is a Box and the 1a-3a changes pattern. The other 1b-8b
changes color. SO it should be possible to first change pattern, then
change color on the pattern u choosed before.


I expect you can only change background color
and change image by one which is tranparent.
if not you must have each pattern in 8 colors ==> 27 possibilities
( white + 8 colors ) * 3 patterns

my example 2 has 3 colors and 4 patterns

--
******** (enlever/remove [OTER_MOI] du/from reply url) *******
Stéphane MORIAUX : mailto:st****** *************** @wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
*************** *************** *************** *************** **
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4184
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or why it doesn't work? Thanks in advance Tjerk
2
12830
by: Raigo | last post by:
There is a bug with IE6 handling Javascript onMouseOver and onMouseOut events. Can it be replaced somehow with CSS? For example when I want to change images when user moves mouse to certain HTML table row and then change image back when user moves mouse out of that row. Take a look at some samples with Javascript: http://213.35.144.144/firmanet.dll/mudel? fkood=BV&pfkood=10&pkood=10&tkood=1020&size=6
2
1863
by: Nick Calladine | last post by:
Is this possible to ... I wish to get the value of a dropdown select but gets is indexable value (dont know if that is the right term) if that is possible (the position it assigned get assigned by the position on the list) this is so i can then pass it to the array called pictureimage to get the correct filename (similar to the picturetext part of this routine) and then the final line on the fuction is to change an original image with...
1
16870
by: Anthony Boudouvas | last post by:
Hi to all, i have a treeview that i put some nodes in it with their repsective images. If i try to change the image and set it to some other ImageList index, nothing happens. The code i use is: private void ChangeServantStatus(string servant, ServantStatus status) {
2
8535
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error like "gcnew is undeclared error",how to deeclare 'gcnew" and when i am using in runtime to change the size of images in imagelist in listview control in .net(forms application) by chnging one trckbar(like tb1->Value),
35
2674
by: Stan Sainte-Rose | last post by:
Hi, What is the better way to save image into a database ? Just save the path into a field or save the image itself ? I have 20 000 images (~ 10/12 Ko per image ) to save. Stan
3
3190
by: vj | last post by:
how to change images based on action. Even clicking changed images should do respective actions. and while displaying only one image at a time sholud get displayed. I am using three images for a single column of a table in Jsp. Any clues. Any link for any good javascript html jsp site where i can find some good solution. here swaping hiding which will work well.
7
3002
by: Leoa | last post by:
Hi All, I'm having a hard time figuring out the DOM syntax to get one frame that has thumnails of images to display at full size in another frame (onmouseover). I looked at a couple tutorials and have come up with the broken script below. Please Help.- ------------------------------------------
5
5353
by: rosaryshop | last post by:
I'm working a jewelry/rosary design web site at http://www.rosaryshop.com/rosariesAndKits2.php. As the user makes selections, it updates images of various parts, giving them a preview of the finished item. The preview resides within a div and is simply a series of <br>-separated images. Simple html. The system is working fine with FireFox and Safari, but some MSIE 6 and 7 users are reporting that only the first image is updating and the...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10049
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.