i have two file 1)Html=which has html code.. 2).js file which has 2 functions Problem);;i want when i click the image , .js file(its fucntions) should be called and image should be resized according to the code.. But what i am doing ,it is not being doing 1)contents of html file is as under <html> <body> <body onload="changeIt();"> <head> <script langauge="javascript"> function changeIt() { var width=50; var height=50; document.image.width=width document.image.height=height } </script> </head> <img src="/home/administrator/Desktop/aa.jpeg" name="image" onclick=src="/var/www/external.js/changeeIt();"> </body> </html> 2)Content of .js file is as under function changeeIt() { if(count==1) { var width=500 var height=500 document.image.width=width document.image.height=height count=2; } else if(count==2) { var amrit1=50 var pal=50 document.image.width=amrit1 document.image.height=pal count=1; } } Please somebody help Thanks in advance
<img src="a.jpg" id="myImg" onclick="this.style.width='500px';this.style.height='500px';" style="width:50px;height:50px"/> Code (markup):
zicoone,i think u didnt get the problem,bt thanks for reply. <img src="a.jpg" id="myImg" onclick="this.style.width='500px';this.style.height='500px';" style="width:50px;height:50px"/> actully the problem is .js file has the 2 function that has the coding for resizeing the image.. but i am unable to call .js file at image click please help me how to call(syntax) .js file from html file when image is clicked
<html> <body> <body onload="changeIt();"> <head> <script langauge="javascript"> function changeIt() { var width=50; var height=50; document.image.width=width document.image.height=height } </script> </head> <img src="/home/administrator/Desktop/aa.jpeg" name="image" onclick=src="/var/www/external.js/changeeIt();"> </body> </html> And this is the .js file function changeeIt() { if(count==1) { var width=500 var height=500 document.image.width=width document.image.height=height count=2; } else if(count==2) { var amrit1=50 var pal=50 document.image.width=amrit1 document.image.height=pal count=1; } }