[thelist] How to apply same function to all the images
Amrit Pal
amrit.pal27 at yahoo.com
Mon Oct 11 01:49:25 CDT 2010
i have to files
1).html file>>>it has one function defined inside it that is changeIt() that
works on the page loads.
2).js file >>>it has 1 functions that is changeeIt() and it works at the image
click...
Both are working well for single image,but i want to all more image on the same
page.. so how to make the use of these function at images
1)the coding of html file is as under>>>.
1. <html>
2. <head>
3.
4.
<script language="javascript" src="C:\Documents and Settings\Administrator\Desktop\external.js"></script>
5. <script langauge="javascript">
6. function changeIt()
7. {
8.
9. var width=50;
10. var height=50;
11. document.image.width=width
12. document.image.height=height
13. }
14. </script>
15.
16. </head>
17. <body>
18. <body onload="changeIt();">
19.
<img src="C:\Documents and Settings\Administrator\Desktop\a.jpg" name="image" onclick="changeeIt();">
20.
21. </body>
22. </html>
2)coding of .js file is as under..
1. var count=1;
2. function changeeIt()
3. {
4. if(count==1)
5. {
6. var width=500
7. var height=500
8. document.image.width=width
9. document.image.height=height
10. count=2;
11. }
12. else if(count==2)
13. {
14. var amrit1=50
15. var pal=50
16. document.image.width=amrit1
17. document.image.height=pal
18. count=1;
19. }
20. }Please somebody help..
Thanks in advance
More information about the thelist
mailing list