Thanks a lot. It's working. When the user places it vertically instead of "alert" I used document.myform.adver.value = "Vertical"; so that vertical will be inserted into the textbox and accordingly for horizontal document.myform.adhor.value = "Horizontal";. This is what I had modified. I have done this because I will be passing these values to a script and in turn to a database.
document.myform.adhor.value = "Horizontal";
document.myform.adver.value = "Vertical";
In the above code if the user FIRST places it vertically then the "Vertical"would be entered into the relevant textbox. But if the user changes his mind and rotates it again the code would enter "Horizontal" into the relevant box.
At this point I would not know whether he placed the vertically or horizontally as both "vertical" and "horizontal" would have been entered. The code which you had written was perfect but I dont want the alert button to be displayed. How do I fix this issue. I need the last position value to be inserted into the textbox. I hope that i was clear in my query. This link might be more clearer.