Jump to content

[SOLVED] onclick change image border


supermerc

Recommended Posts

Hi,

 

Im a complete noob at javascript and I have a table with a bunch of images that when you click on them it selects a hidden radio button, however since the radio button is hidden theres no way for the user to see what is selected so I want to have an onclick function that will change the border to lets say 3 pixel and red to show that its selected.

 

Anyone know how to do that?

Link to comment
https://forums.phpfreaks.com/topic/159020-solved-onclick-change-image-border/
Share on other sites

I have this code

 

function selectItem(divid){
var item_border = document.getElementById(divid);
var item_box = document.getElementById(divid);

if(item_box.checked == true)
{
	item_box.checked = false;
	item_border.style.border="0px";
}
else
{
	item_box.checked = true;
	item_border.style.border="2px solid #cc0000";
}
}

 

But all it does is it selects it, it doesnt change the border :S

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.