Jump to content

changing image src on button click


sweetysweety

Recommended Posts

hi.i have a website like:http://www.terranartworks.com/testsite/tsv1/islerimiz.htmli want to change the sources of images,which stays on the white panel,at every click of the grey buttons at the bottom.i did this with switch case but it does this only one click.another clicks they don't.i want to identify only one image tag and change the source according to button.i mean only the xxx part will change according to index comes from button:imajlar/ISLERGORSELLER/xxx/xxx-bilgiler.pngi don't know can i explain my problem.how can i do this?

Link to comment
Share on other sites

Do you really think this...

switch(true)		{		case($image.attr("src")=="imajlar/ISLERGORSELLER/1/1-bilgiler.png"):		$image.attr("src","imajlar/ISLERGORSELLER/2/2-bilgiler.png");		break;

...looks like this...

 

http://www.w3schools.com/js/js_switch.asp

 

 

...you could try...

switch($image.attr("src")){	case "imajlar/ISLERGORSELLER/1/1-bilgiler.png":	$image.attr("src","imajlar/ISLERGORSELLER/2/2-bilgiler.png");	break;	case "imajlar/ISLERGORSELLER/2/2-bilgiler.png":	$image.attr("src","imajlar/ISLERGORSELLER/3/3-bilgiler.png");	break;	case "imajlar/ISLERGORSELLER/3/3-bilgiler.png":	$image.attr("src","imajlar/ISLERGORSELLER/4/4-bilgiler.png");	break;
Edited by davej
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...