473,394 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

show / hide icons or pictures

12
Hello,

I'd want to show and hide the same icons (pictures) on a web page that contains several icons. Some are identical, some are different (for ex : 3 items "A", 4 items "B", 2 items "C").
Is it possible to make radio buttons or check cases to show all the same items on the page (and to hide them if no action is done on the buttons) ?
(I'd want one button for items "A", one another for items "B", and a third for items "C").
All the items are located in absolute position on the page.

Thanks a lot for your help.
Aug 2 '06 #1
9 18495
iam_clint
1,208 Expert 1GB
Give an example of your html code and what exactly you want the javascript to be doing.
Aug 2 '06 #2
mimenko
12
Sorry, I don't have any html code for the moment. I'd just want to know if my request is possible or not, and in what language (javascript, dhtml,...).

The items I've told are small pictures (icons) that are located in all the web page, like that :

A C B
B A C
B C A C A
...

All the letters "A" represents the same icon, and so on for the letters B and C.
My question is : is it possible to hide (and show) with one button ALL the icons "A", with another button ALL th icons "B", ... ?

Thanks a lot, I'm French and beginner with programming, and I didn't find a solution on websites...
Aug 2 '06 #3
iam_clint
1,208 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function hide(which) {
  3. var hide = new Array();
  4. hide = document.getElementsByName(which);
  5. for (i=0; i<hide.length; i++) {
  6.   hide[i].width = 0;
  7.   hide[i].height = 0;
  8. }
  9. }
  10. </script>
  11. <input type="button" value="Hide A" onclick="hide('a');"><input type="button" value="Hide B" onclick="hide('b');"><input type="button" value="Hide C" onclick="hide('c');"><br>
  12. <img src="http://www.thescripts.com/images/noavatar.gif" name="a">
  13. <img src="http://www.thescripts.com/images/logo.jpg" name="b"><br>
  14. <img src="http://www.thescripts.com/images/noavatar.gif" name="a">
  15. <img src="http://www.thescripts.com/forum/images/cnome_buttons/reply.gif" name="c"><br>
  16. <img src="http://www.thescripts.com/images/logo.jpg" name="b">
  17. <img src="http://www.thescripts.com/forum/images/cnome_buttons/reply.gif" name="c"><br>
  18. <img src="http://www.thescripts.com/forum/images/cnome_buttons/reply.gif" name="c">
  19. <img src="http://www.thescripts.com/images/noavatar.gif" name="a">
  20.  
heres an example i made up for you.
Aug 3 '06 #4
iam_clint
1,208 Expert 1GB
now if you wanted to show them also you won't want to do it this way you will want to give each one a style of hidden instead of resizing the image to 0.
Aug 3 '06 #5
mimenko
12
Yeah ! Great !
But I don't understand the way to show the items. It's probably with "visibility", but I don't know how to proceed...
How can I do if I want the items are hidden at the first state ?
Thanks a lot for all.

Phil
Aug 3 '06 #6
iam_clint
1,208 Expert 1GB
look up CSS styles hidden on google and then change image.width and image.height to the css hidden style and the div will then be labled a b c not the actual images itself.
Aug 3 '06 #7
mimenko
12
look up CSS styles hidden on google and then change image.width and image.height to the css hidden style and the div will then be labled a b c not the actual images itself.
Thanks, but I'm so bad with web programming ! I've tried this, but it's not the solution :

function show(which) {
var show = new Array();
show = document.getElementsByName(which);
for (i=0; i<show.length; i++) {
show[i].style.display = 'true';
}
}
Aug 4 '06 #8
iam_clint
1,208 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function hide(which) {
  3. var hide = new Array();
  4. hide = document.getElementsByName(which);
  5. for (i=0; i<hide.length; i++) {
  6.   hide[i].style.display = 'none';
  7. }
  8. }
  9. function show(which) {
  10. var hide = new Array();
  11. hide = document.getElementsByName(which);
  12. for (i=0; i<hide.length; i++) {
  13.   hide[i].style.display = 'inline';
  14. }
  15. }
  16. </script>
  17. <input type="button" value="Hide A" onclick="hide('a');"><input type="button" value="Hide B" onclick="hide('b');"><input type="button" value="Hide C" onclick="hide('c');"><br>
  18. <input type="button" value="Show A" onclick="show('a');"><input type="button" value="Show B" onclick="show('b');"><input type="button" value="Show C" onclick="show('c');"><br>
  19. <img src="http://www.thescripts.com/images/noavatar.gif" name="a">
  20. <img src="http://www.thescripts.com/images/logo.jpg" name="b"><br>
  21. <img src="http://www.thescripts.com/images/noavatar.gif" name="a">
  22. <img src="http://www.thescripts.com/forum/images/cnome_buttons/reply.gif" name="c"><br>
  23. <img src="http://www.thescripts.com/images/logo.jpg" name="b">
  24. <img src="http://www.thescripts.com/forum/images/cnome_buttons/reply.gif" name="c"><br>
  25. <img src="http://www.thescripts.com/forum/images/cnome_buttons/reply.gif" name="c">
  26. <img src="http://www.thescripts.com/images/noavatar.gif" name="a">
  27.  
Heres how it could be done.
Aug 4 '06 #9
mimenko
12
Thank you very much. Exactly what I wanted.

Phil
Aug 4 '06 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: oLE | last post by:
I would like to add some javascript to show/hide a certain row of a table. The first row of the table contain the hyperlink that calls the javascript the second row is the one i want to show/hide...
7
by: 7mary4 | last post by:
I am working on a kiosk for a museum, we will be using firefox as the browser, with windows, and a touch screen. We'd like to create a slide show of a small portfolio when the visitors click...
2
by: Mateo | last post by:
Hi! I have a litle JS problem.... I'm trying to make show/hide table JS function, but my show/hide table function works only on IE.... It works in mozilla partially. Actually,every time when I...
1
by: Dinesh Narayan | last post by:
Hello, I'm writing an application with Visual Studio 2003.NET using C++, I'm hoping someone could tell me how to make icons appear in menubars next menu items. Windows apps like Office Word 2003,...
1
by: mimenko | last post by:
Hello, I'd want to show and hide the same icons (pictures) on a web page that contains several icons. Some are identical, some are different (for ex : 3 items "A", 4 items "B", 2 items "C"). Is...
3
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
3
by: cal | last post by:
Hi group, Wich one is the class to handle desktop icons? I want to modify for example the file path the Icon points to. of course, its the path of the file u open when u doubleclick the icon. ...
5
by: Alexnb | last post by:
Hello I am sure most of you are familiar with py2exe. I am having a bit of a problem. See the program has a few pictures involved and the .ico it uses for the windows. However, the pictures are...
1
oranoos3000
by: oranoos3000 | last post by:
hi would you please help me i have a online shopping center that i show pictures of the my product in home page. in the InterExplorer pictures is shown correctly but in Firefox browser is shown...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.