Hello any one please tell me how to select and unselect all images in javascript
just like checkboxes

Hello Muhammad shah,

I'm not sure I got you, but I think you asked for a button which would check or uncheck all checkboxes on a webpage? If so, I whipped something together:

<html>
<head>
	<script type="text/javascript">
		function checkall(){
			boxes = document.getElementsByTagName("input");
			max = boxes.length;
			i = 0;
			
			for(i=0;i<=max;i++){
				boxes[i].checked = true;
			}
		}
		
		function uncheckall(){
			boxes = document.getElementsByTagName("input");
			max = boxes.length;
			i = 0;
			
			for(i=0;i<=max;i++){
				boxes[i].checked = false;
			}
		}
	</script>
</head>
<body>
	<input type="checkbox">
	<input type="checkbox">
	<input type="checkbox">
	<input type="checkbox">
	<input type="checkbox">
	<input type="checkbox">
	<input type="checkbox">
	<input type="checkbox">
	<input type="checkbox">
	<input type="checkbox">
	
	<br>
	
	<button onclick="checkall()">Check all</button>
	<button onclick="uncheckall()">Uncheck all</button>
</body>
</html>

The two small functions there find all inputs which are able to be checked (checkboxes and radiobuttons, that is). In other words, it's a very brief and general example, as it doesn't limit itself in scope, but that could of course be resolved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.