onclick event in dropdown

Posted by raam on Stack Overflow See other posts from Stack Overflow or by raam
Published on 2010-03-27T10:48:18Z Indexed on 2010/03/27 12:33 UTC
Read the original article Hit count: 292

Filed under:
<html>
 <head>
 </style>
  <script type="text/javascript">

   function ram(){
   document.write("Hello World!")
   alert("ok");
   }
  </script>
 </head>
 <body>

 <select id="country">
 <option value="India" id="101" onfocus="ram()">India</option>
 <option value="Autralia" id="102" onClick="ram();">Autralia</option>
 <option value="England" id="103" onfocus="ram();">England</option>
 <option value="Ameriaca" id="104" onfocus="ram();">Ameriaca</option>
<option value="Pakistan" selected="selected" id="105" onfocus="ram();" >Pakistan</option>
 </select>
 </body>
</html>

In this above code the event will not fire for dropdown. I try by using focus and click event. I can I do this and I want 1 more thing if I select dropdown value as India, I want to create a dropdown with state (elements are TN, DL, etc) updation.

© Stack Overflow or respective owner

Related posts about html