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/
*************** *************** *************** *************** **