Thanks VolcomMky, I did it with a modification of your code:
JAVASCRIPT:
Code:
<script type="text/javascript">
function addborder(here)
{
var imgTag = "<div style='height:77px; width:102px; background-color: #F60; display:table-cell; position:relative; vertical-align:middle;'><img src='"+here+".jpg' onclick='removeborder("+here+")'/>";
document.getElementById('p'+here).innerHTML = imgTag;
}
function removeborder(here)
{
var imgTag = "<div style='height:77px; width:102px; background-color: #FFF; display:table-cell; position:relative; vertical-align:middle;'><img src='"+here+".jpg' onclick='addborder("+here+")'/>";
document.getElementById('p'+here).innerHTML = imgTag;
}
</script>
PHP:
PHP Code:
<?php
for($i = 1; $i < 7; $i++){
print '<div id="p'.$i.'" style="display:table; float:left;text-align:center;vertical-align:middle;">
<div style="height:77px; width:102px; background-color: #FFF; display:table-cell; position:relative; vertical-align:middle;">
<img src="'.$i.'.jpg" alt="" onclick="addborder('.$i.')" />
</div>
</div>';
}
?>
Bookmarks