/    Sign up×
Community /Pin to ProfileBookmark

loading array then saving new array

need to convert this i think to php, this has the functions i need to image swap the photos but wont save the changes.
i think i need to store all the src in a file to display images as an array then when i make a change with image swap to automatically save the array or have update button to save new array.
here is the code i currently have as an example just with function
any help will be greatly appreciated

[CODE]<!DOCTYPE html>
<html lang=”en”>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=UTF-8″ />
<title>Swap demo</title>

<style type=”text/css”>
#GALLERY td {
height: 200px; width: 200px;
text-align: center;
vertical-align: middle;
}
#GALLERY td img, #GALLERY td img.normal {
border: solid white 5px;
}
#GALLERY td img.highlighted {
border: solid red 5px;
}
</style>

</head>
<body>
<table id=”GALLERY”>
<tr>
<td>
<img src=”http://www.clearviewarts.com/thumbnails/Puppy In Basket.jpg” alt=”Dogs”/>
</td>
<td>
<img src=”http://www.clearviewarts.com/thumbnails/BabyIndy.jpg” alt=”Dogs”/>
</td>
<td>
<img src=”http://www.clearviewarts.com/thumbnails/HarlequinDane.jpg” alt=”Dogs”/>
</td>
</tr>
<tr>
<td>
<img src=”http://www.clearviewarts.com/thumbnails/Pug.jpg” alt=”Dogs”/>
</td>
<td>
<img src=”http://www.clearviewarts.com/thumbnails/Wagner-edit1.jpg” alt=”Dogs”/>
</td>
<td>
<img src=”http://www.clearviewarts.com/thumbnails/CanusAngelicus.jpg” alt=”Dogs”/>
</td>
</tr>
</table>

<script type=”text/javascript”>
var pix = document.getElementById(“GALLERY”).getElementsByTagName(“img”);
for ( var p = 0; p < pix.length; ++p )
{
pix[p].onclick = picclick;
}

var firstImage = null;
function picclick( )
{
// to cancel a swap, click on first image again:
if ( firstImage == this )
{
this.className = “normal”;
firstImage = null;
return;
}
// is this first image clicked on?
if ( firstImage == null )
{
// yes
firstImage = this;
this.className = “highlighted”;
return; // nothing more to do
}
// aha! second image clicked on, so do swap
firstImage.className = “normal”;
var temp = this.src;
this.src = firstImage.src;
firstImage.src = temp;
firstImage = null;

}
</script>
</body>
</html>[/CODE]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@rootJul 20.2013 — You might get a better response if you posted in the Javascript forum.
×

Success!

Help @lnsflive spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.13,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...