Jump to content

help in swaping images plz


delickate

Recommended Posts

hi,

i've 3 image in same page.

image A,B,C from database.

i would like to swap these 3 images in click.i've images on page like.

  A

B    C

 

A on center

B on left side

C on right side

 

if i click on B it goes to A's place and A must positioned on B and atructure should be like

  B

A  C

then if i clike on C then B & C should swap like

  C

A  B

i dont need click on center image.just click on left or right image and they swap.can any one do fever me plz?

Link to comment
Share on other sites

I think javascript would probably be more effective with php you will need a refresh everytime you swap a certain image. but if it is php since you are probably trying to order your gallery. I would add a position field for each image in your database.

 

then each image on your php page you put in a hyperlink

<a href="update_image_position.php?image_id=1"><image src="image.png" /></a>

 

and on the update_image_position.php page you do a mysql update query and the redirect back to your gallery page

Link to comment
Share on other sites

HERE YOU GO IT ALL DYNAMIC MATE...........

 

try this for a lath tell me what you think mate!

 

javascript sucks use php html xhtml css .......................

 

<?php
$a="
<table align='center' border='0'><tr>
<td>
<table align='center' border='0'><tr>
<td>
<a href='".$_SEVER['PHP_SELF']."?cmd=a'>
<img width='20px' src='http://www.vendian.org/howbig/UnstableURLs/letter_a.gif'/>
</a>
</td>
<td>
<a href='".$_SEVER['PHP_SELF']."?cmd=b'>
<img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-B.jpg' />
</a>
</tr></td>
</table>
<table align='center' border='0'><tr>
<tr>
<td>
<a href='".$_SEVER['PHP_SELF']."?cmd=c'>
<img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-C.jpg' />
</a>
</tr></td></table>
</tr></td></table>
";
?>

<?php

if($_GET['cmd']==a){

echo $a;

exit;

}
?>


<?php
$b="
<table align='center' border='0'><tr>
<td>
<table align='center' border='0'><tr>
<td>
<a href='".$_SEVER['PHP_SELF']."?cmd=b'>
<img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-B.jpg' />
</a>
</td>
<td>
<a href='".$_SEVER['PHP_SELF']."?cmd=c'>
<img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-C.jpg' />
</a>
</tr></td>
</table>
<table align='center' border='0'><tr>
<td>
<a href='".$_SEVER['PHP_SELF']."?cmd=a'>
<img width='20px' src='http://www.vendian.org/howbig/UnstableURLs/letter_a.gif'/>
</a>
</tr></td></table>
</tr></td></table>
";
?>

<?php

if($_GET['cmd']==b){

echo $b;

exit;
}
?>

<?php
echo"
<table align='center' border='0'><tr>
<td>
<table align='center' border='0'><tr>
<td>
<a href='".$_SEVER['PHP_SELF']."?cmd=c'>
<img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-C.jpg' />
</a>
</td>
<td>
<a href='".$_SEVER['PHP_SELF']."?cmd=a'>
<img width='20px' src='http://www.vendian.org/howbig/UnstableURLs/letter_a.gif'/>
</a>
</tr></td>
</table>
<table align='center' border='0'><tr>
<td>
<a href='".$_SEVER['PHP_SELF']."?cmd=b'>
<img width='20px' src='http://willowtreehome.com/Merchant2/graphics/00000001/Village/LET-B.jpg' />
</b>
</tr></td></table>
</tr></td></table>
";
?>

<?php
if($_GET['cmd']==c){

echo $c;

exit;
}
?>

Link to comment
Share on other sites

HERE GOES WHY REDARROW THINKS JAVASCRIPT SUCKS..........

 

I design a grate looking web site selling apples,I get it on the very top off all search engines, i really really spend

100 of hours geting loads off traffic...........

 

A user comes to my web site wanting to order 10.000 pound worth off apples but he couldnt becouse he refuse to have javascript enabled on his browser.......

 

i lost 10 ground ........

 

EXSPLAINED.....

 

so is javascript really any good not for me anyway...

 

javascript is client side so users have the abilty to turn it on or off from there browser...

 

Link to comment
Share on other sites

This is irelleavant, but I must say that was quite the burn...

 

I suppose you're referring to me. For someone who claims to have nine years of experience with Javascript and 20 years of experience with creating websites (source) it shouldn't be too hard to overcome the "problem" redarrow explained.

Link to comment
Share on other sites

There is no way that anybody can tell me that javascript is crap...

 

users can turn javascript off...

 

 

It all hipe javascript/ajax it all clint controlled sorry everyone but i dont think javasript means anythink to anyone sorry....

Link to comment
Share on other sites

((dan)) I also read the comment you said about my profile, because ive done 20 years in seo you assume i haven’t because off seo wasn’t around or html well the term seo and html wasn’t your correct sorry,  But i was creating bbs for Commodore 64 in machine code via telephone lines

back in 1995.....

 

Dan you don’t need to be nasty to me, or put me down, just because i don’t like JavaScript do ya?

 

I agree with you on the post you posted about javascript and the links you provided, but i just think that

JavaScript Ajax is a way to get web page's just look flash......

 

The only reason i think personally JavaScript is crap, is that many clients Ive ever had in the pass all complain

that there users refuse to turn JavaScript on, not because  the way the JavaScript was coded or implemented just because users didn’t want to turn JavaScript on full stop..

 

I also have worked with macromedia flash products and programming concepts,  that was also another big problem where users didn’t want to download the plug-in, even Theo i tried my best to stop lagging with the macromedia server's didn’t go down to well....

 

I am sorry if i have touch a sore point in saying that JavaScript is crap, don’t mean to offend the hard scripting communities in JavaScript or java server communities it the way i fill.

 

If all browser's didn’t have the ability to turn JavaScript off then ill fell so happy to continue to use JavaScript and use all the funky interactive functions the language provides but until then ill have to stick with css, html.

 

Sorry mate but when you into days world go to the jobs offering good well paid programming positions they always ask about JavaScript Ajax and it really pees me off because off the come backs with complaints relating to users not wanting to have JavaScript enabled and it always the programmer/designer who get the boot in the nuts via the boss...

 

I have also noticed that still today, that good old html and css simple looking web sites still win the day with business clients with not one complaint...

 

sorry if ive have offended you in anyway........

 

Link to comment
Share on other sites

I'm sorry that I offended you. I still believe that you have that opinion because you lack the sufficient knowledge about the subject. I was, and am, trying to give you part of that knowledge. At the end of the day, what this site is essentially about is learning. I don't know if you use or have used Gmail, but if you try to compare the responsiveness and overall experience I'm certain you'd be much more pleased to use the Javascript version than using the basic HTML version.

Link to comment
Share on other sites

Enough debating? Well, Delickate I would look into using AJAX in order to do this. You could use PHP but as mentioned, you must also refresh the page to see the image moved. With AJAX you can do this without refreshing the page, unfortunately I don't know any AJAX. But I hope I pointed you in the right direction a little bit.

Link to comment
Share on other sites

I don't know if you use or have used Gmail, but if you try to compare the responsiveness and overall experience I'm certain you'd be much more pleased to use the Javascript version than using the basic HTML version.

 

Or even just here on these boards - the quick option to reply and the quick modify buttons are much nicer than having a whole new page reload.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.