Saved Bookmarks
| 1. |
Write the code to display a form along with the javascript as shown below. User should be able to select a picture after clicking on browse button and when he presses “click” button, the picture should be displayed.Next the user should be able to enter value of image height and width and when he presses “apply” button, the size of picture should change as shown: |
|
Answer» <html> <head><script language="javascript"> function first() { document.f1.img1.src=document.f1.f2.value } function second() { document.f1.img1.width=document.f1.t2.value document.f1.img1.height=document.f1.t1.value } </script></head> <body> <form name =f1> Select the image that you want to display<br> <input type=file name=f2><br> <img width=300 height=300 name=img1> <br><input type=button name=b1 value=apply onclick=first()><br> specify the new height<input type=text name=t1><br> specify the new width<input type=text name=t2><br> <input type=button name=b2 value=apply onclick=second()><br> </form> </body> </html> |
|