<html>
    <head>
    <script>

        function myfunction(val)
        {
                var x=document.getElementById('ops');
                var y=document.getElementById('text');
                var z=document.getElementById('lb');
                //if(val='pepsi')
                {   
                    z.style.display = "block";
                    y.style.display = "Inline";
                }
    }
    function myfun2()
                {
                var c=document.getElementById("lb1");
                var b=document.getElementById("btn1");
                b.style.display="block";
                c.style.display="block"
                }
    
     function validator()
      {
                var x = document.forms["mform"]["qtytext"].value;
                
                if (x == null || x == "") {
                    alert("Please enter a valid number");
                    return false;
                }
                var n = x.search(/\D/);
                if (n >= 0){
                     alert("Please enter a valid number");
                    return false;
                }
      }            
                
                
        </script>


    </head>
    <body>
    <form name='mform' onsubmit="return validator()">
    <select id="ops" onChange="myfunction(this.value);">
    <option>Pick item </option>
    <option value="pepsi">pepsi</option>
    <option value="coke">coke</option>
    <option value="fanta">Fanta</option>
    </select><br><br>
    <label id="lb" style="display:none" >Qty</label>
    <input type="text" name='qtytext' id="text" style="display:none" onFocus="myfun2()"/>

    <label id="lb1" style="display:none" >.....Before proceeding, Make sure that form is properly filled.....</label>
    <input type="submit"  id='btn1' value="Submit" style='display:none' /> <br>

    </form>
    </body>
    </html>